#include "chrome/browser/devtools/devtools_file_watcher.h"
#include <map>
#include <memory>
#include <set>
#include <unordered_map>
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/lazy_thread_pool_task_runner.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
#include "content/public/browser/browser_thread.h"
BrowserThread;
static constexpr int kFirstThrottleTimeout = …;
static constexpr int kDefaultThrottleTimeout = …;
class DevToolsFileWatcher::SharedFileWatcher
: public base::RefCounted<SharedFileWatcher>,
public base::trace_event::MemoryDumpProvider { … };
DevToolsFileWatcher::SharedFileWatcher::SharedFileWatcher()
: … { … }
DevToolsFileWatcher::SharedFileWatcher::~SharedFileWatcher() { … }
bool DevToolsFileWatcher::SharedFileWatcher::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* process_memory_dump) { … }
void DevToolsFileWatcher::SharedFileWatcher::AddListener(
DevToolsFileWatcher* watcher) { … }
void DevToolsFileWatcher::SharedFileWatcher::RemoveListener(
DevToolsFileWatcher* watcher) { … }
void DevToolsFileWatcher::SharedFileWatcher::AddWatch(
const base::FilePath& path) { … }
DevToolsFileWatcher::SharedFileWatcher::FilePathTimesMap
DevToolsFileWatcher::SharedFileWatcher::GetModificationTimes(
const base::FilePath& path) { … }
void DevToolsFileWatcher::SharedFileWatcher::RemoveWatch(
const base::FilePath& path) { … }
void DevToolsFileWatcher::SharedFileWatcher::DirectoryChanged(
const base::FilePath& path,
bool error) { … }
void DevToolsFileWatcher::SharedFileWatcher::DispatchNotifications() { … }
namespace {
base::SequencedTaskRunner* impl_task_runner() { … }
}
DevToolsFileWatcher::SharedFileWatcher* DevToolsFileWatcher::s_shared_watcher_;
void DevToolsFileWatcher::Deleter::operator()(const DevToolsFileWatcher* ptr) { … }
DevToolsFileWatcher::DevToolsFileWatcher(
WatchCallback callback,
scoped_refptr<base::SequencedTaskRunner> callback_task_runner)
: … { … }
DevToolsFileWatcher::~DevToolsFileWatcher() { … }
void DevToolsFileWatcher::InitSharedWatcher() { … }
void DevToolsFileWatcher::AddWatch(base::FilePath path) { … }
void DevToolsFileWatcher::RemoveWatch(base::FilePath path) { … }
void DevToolsFileWatcher::AddWatchOnImpl(base::FilePath path) { … }
void DevToolsFileWatcher::RemoveWatchOnImpl(base::FilePath path) { … }