Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: content/browser/loader/netlog_observer.h

Issue 2115823004: Avoid using BrowserThread and ContentBrowserClient in NetLogObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix leak Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/devtools/devtools_manager.cc ('k') | content/browser/loader/netlog_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/netlog_observer.h
diff --git a/content/browser/loader/netlog_observer.h b/content/browser/loader/netlog_observer.h
index 330a502e50afd7643ac8a5acb1e2d22f858d3c59..eed22332fa4efaf64e31324206821b617f13bd91 100644
--- a/content/browser/loader/netlog_observer.h
+++ b/content/browser/loader/netlog_observer.h
@@ -8,8 +8,10 @@
#include <stdint.h>
#include "base/containers/hash_tables.h"
+#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
#include "content/public/common/resource_devtools_info.h"
#include "net/log/net_log.h"
@@ -34,9 +36,9 @@ class NetLogObserver : public net::NetLog::ThreadSafeObserver {
// net::NetLog::ThreadSafeObserver implementation:
void OnAddEntry(const net::NetLog::Entry& entry) override;
- void OnAddURLRequestEntry(const net::NetLog::Entry& entry);
+ // The NetLog instance is passed in via the |net_log| parameter.
+ static void Attach(net::NetLog* net_log);
- static void Attach();
static void Detach();
// Must be called on the IO thread. May return NULL if no observers
@@ -52,10 +54,17 @@ class NetLogObserver : public net::NetLog::ThreadSafeObserver {
ResourceInfo* GetResourceInfo(uint32_t id);
+ void OnAddURLRequestEntry(const net::NetLog::Entry& entry);
+
typedef base::hash_map<uint32_t, scoped_refptr<ResourceInfo>>
RequestToInfoMap;
RequestToInfoMap request_to_info_;
+ // Used to validate that calls to the NetLogObserver methods occur on the
+ // thread it was instantiated on. Typically the IO thread.
+ static base::LazyInstance<std::unique_ptr<base::ThreadChecker>>::Leaky
+ io_thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(NetLogObserver);
};
« no previous file with comments | « content/browser/devtools/devtools_manager.cc ('k') | content/browser/loader/netlog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698