summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 23:58:46 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 23:58:46 +0000
commit30ac64979c2a74a665ef40101afd5fd4f3c5f0c2 (patch)
tree3999015c27882c3e03db9de6b8effffd1ddae849 /content/browser
parent7e8e701d344b4692977fc09c3b1ec4c6725d6fae (diff)
downloadchromium_src-30ac64979c2a74a665ef40101afd5fd4f3c5f0c2.zip
chromium_src-30ac64979c2a74a665ef40101afd5fd4f3c5f0c2.tar.gz
chromium_src-30ac64979c2a74a665ef40101afd5fd4f3c5f0c2.tar.bz2
Revert 94196 (broke win shared build) - Remove ChromeNetLog dependency from content/browser/debugger.
Add Observer concept to net::NetLog. Use net::NetLog::Observer in ChromeNetLog. Remove ChromeNetLog dependency in content/browser/debugger. Forked from http://codereview.chromium.org/7310029/ to finish Jói's patch. BUG=84078 TEST=existing Review URL: http://codereview.chromium.org/7468019 TBR=dpranke@chromium.org Review URL: http://codereview.chromium.org/7517004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/content_browser_client.h2
-rw-r--r--content/browser/debugger/DEPS6
-rw-r--r--content/browser/debugger/devtools_manager.cc3
-rw-r--r--content/browser/debugger/devtools_netlog_observer.cc19
-rw-r--r--content/browser/debugger/devtools_netlog_observer.h15
-rw-r--r--content/browser/mock_content_browser_client.cc4
-rw-r--r--content/browser/mock_content_browser_client.h1
7 files changed, 24 insertions, 26 deletions
diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h
index a04cee0..5478c7d 100644
--- a/content/browser/content_browser_client.h
+++ b/content/browser/content_browser_client.h
@@ -42,7 +42,6 @@ class CryptoModuleBlockingPasswordDelegate;
namespace net {
class CookieList;
class CookieOptions;
-class NetLog;
class URLRequest;
class URLRequestContext;
class X509Certificate;
@@ -236,7 +235,6 @@ class ContentBrowserClient {
virtual ui::Clipboard* GetClipboard() = 0;
virtual MHTMLGenerationManager* GetMHTMLGenerationManager() = 0;
virtual DevToolsManager* GetDevToolsManager() = 0;
- virtual net::NetLog* GetNetLog() = 0;
// Returns true if fast shutdown is possible.
virtual bool IsFastShutdownPossible() = 0;
diff --git a/content/browser/debugger/DEPS b/content/browser/debugger/DEPS
index db358e1..558fbbd 100644
--- a/content/browser/debugger/DEPS
+++ b/content/browser/debugger/DEPS
@@ -9,11 +9,15 @@ include_rules = [
# devtools_manager.cc, http://codereview.chromium.org/7310029/
"+chrome/browser/browser_process.h",
+ "+chrome/browser/net/chrome_net_log.h",
+
+ # devtools_net_log_observer.cc
+ "+chrome/browser/io_thread.h",
# worker_devtools_manager_io.cc
"+chrome/browser/debugger/devtools_window.h",
"+chrome/browser/profiles/profile_manager.h",
-
+
# devtools_http_protocol_handler.cc
"+ui/base/resource/resource_bundle.h",
"+chrome/browser/ui/webui/devtools_ui.h",
diff --git a/content/browser/debugger/devtools_manager.cc b/content/browser/debugger/devtools_manager.cc
index c79aee7..bc8d4f9 100644
--- a/content/browser/debugger/devtools_manager.cc
+++ b/content/browser/debugger/devtools_manager.cc
@@ -247,7 +247,8 @@ void DevToolsManager::BindClientHost(
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- NewRunnableFunction(&DevToolsNetLogObserver::Attach));
+ NewRunnableFunction(&DevToolsNetLogObserver::Attach,
+ g_browser_process->io_thread()));
}
inspected_rvh_to_client_host_[inspected_rvh] = client_host;
client_host_to_inspected_rvh_[client_host] = inspected_rvh;
diff --git a/content/browser/debugger/devtools_netlog_observer.cc b/content/browser/debugger/devtools_netlog_observer.cc
index 9e278b0..919c53c 100644
--- a/content/browser/debugger/devtools_netlog_observer.cc
+++ b/content/browser/debugger/devtools_netlog_observer.cc
@@ -7,8 +7,7 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "base/values.h"
-#include "content/browser/browser_thread.h"
-#include "content/browser/content_browser_client.h"
+#include "chrome/browser/io_thread.h"
#include "content/common/resource_response.h"
#include "net/base/load_flags.h"
#include "net/http/http_net_log_params.h"
@@ -22,14 +21,14 @@ const size_t kMaxNumEntries = 1000;
DevToolsNetLogObserver* DevToolsNetLogObserver::instance_ = NULL;
-DevToolsNetLogObserver::DevToolsNetLogObserver(net::NetLog* net_log)
- : net::NetLog::ThreadSafeObserver(net::NetLog::LOG_ALL_BUT_BYTES),
- net_log_(net_log) {
- net_log_->AddThreadSafeObserver(this);
+DevToolsNetLogObserver::DevToolsNetLogObserver(ChromeNetLog* chrome_net_log)
+ : ChromeNetLog::ThreadSafeObserver(net::NetLog::LOG_ALL_BUT_BYTES),
+ chrome_net_log_(chrome_net_log) {
+ chrome_net_log_->AddObserver(this);
}
DevToolsNetLogObserver::~DevToolsNetLogObserver() {
- net_log_->RemoveThreadSafeObserver(this);
+ chrome_net_log_->RemoveObserver(this);
}
DevToolsNetLogObserver::ResourceInfo*
@@ -236,11 +235,11 @@ void DevToolsNetLogObserver::OnAddSocketEntry(
}
}
-void DevToolsNetLogObserver::Attach() {
+void DevToolsNetLogObserver::Attach(IOThread* io_thread) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(!instance_);
- instance_ = new DevToolsNetLogObserver(
- content::GetContentClient()->browser()->GetNetLog());
+ instance_ = new DevToolsNetLogObserver(io_thread->net_log());
}
void DevToolsNetLogObserver::Detach() {
diff --git a/content/browser/debugger/devtools_netlog_observer.h b/content/browser/debugger/devtools_netlog_observer.h
index 3fe2765..75b3314 100644
--- a/content/browser/debugger/devtools_netlog_observer.h
+++ b/content/browser/debugger/devtools_netlog_observer.h
@@ -8,13 +8,14 @@
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
-#include "net/base/net_log.h"
+#include "chrome/browser/net/chrome_net_log.h"
#include "webkit/glue/resource_loader_bridge.h"
namespace net {
class URLRequest;
} // namespace net
+class IOThread;
struct ResourceResponse;
// DevToolsNetLogObserver watches the NetLog event stream and collects the
@@ -24,16 +25,16 @@ struct ResourceResponse;
// As DevToolsNetLogObserver shares live data with objects that live on the
// IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be
// called from other threads.
-class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
+class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver {
typedef webkit_glue::ResourceDevToolsInfo ResourceInfo;
public:
- // net::NetLog::ThreadSafeObserver implementation:
+ // ThreadSafeObserver implementation:
virtual void OnAddEntry(net::NetLog::EventType type,
const base::TimeTicks& time,
const net::NetLog::Source& source,
net::NetLog::EventPhase phase,
- net::NetLog::EventParameters* params) OVERRIDE;
+ net::NetLog::EventParameters* params);
void OnAddURLRequestEntry(net::NetLog::EventType type,
const base::TimeTicks& time,
@@ -53,7 +54,7 @@ class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
net::NetLog::EventPhase phase,
net::NetLog::EventParameters* params);
- static void Attach();
+ static void Attach(IOThread* thread);
static void Detach();
// Must be called on the IO thread. May return NULL if no observers
@@ -65,12 +66,12 @@ class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
private:
static DevToolsNetLogObserver* instance_;
- explicit DevToolsNetLogObserver(net::NetLog* net_log);
+ explicit DevToolsNetLogObserver(ChromeNetLog* chrome_net_log);
virtual ~DevToolsNetLogObserver();
ResourceInfo* GetResourceInfo(uint32 id);
- net::NetLog* net_log_;
+ ChromeNetLog* chrome_net_log_;
typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap;
typedef base::hash_map<uint32, int> RequestToEncodedDataLengthMap;
typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap;
diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc
index 9d5c3e5..6ad3abf 100644
--- a/content/browser/mock_content_browser_client.cc
+++ b/content/browser/mock_content_browser_client.cc
@@ -188,10 +188,6 @@ DevToolsManager* MockContentBrowserClient::GetDevToolsManager() {
return NULL;
}
-net::NetLog* MockContentBrowserClient::GetNetLog() {
- return NULL;
-}
-
bool MockContentBrowserClient::IsFastShutdownPossible() {
return true;
}
diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h
index 157f9d3..ff00fec 100644
--- a/content/browser/mock_content_browser_client.h
+++ b/content/browser/mock_content_browser_client.h
@@ -94,7 +94,6 @@ class MockContentBrowserClient : public ContentBrowserClient {
virtual ui::Clipboard* GetClipboard() OVERRIDE;
virtual MHTMLGenerationManager* GetMHTMLGenerationManager() OVERRIDE;
virtual DevToolsManager* GetDevToolsManager() OVERRIDE;
- virtual net::NetLog* GetNetLog() OVERRIDE;
virtual bool IsFastShutdownPossible() OVERRIDE;
virtual WebPreferences GetWebkitPrefs(Profile* profile,
bool is_web_ui) OVERRIDE;