summaryrefslogtreecommitdiffstats
path: root/net/proxy/multi_threaded_proxy_resolver.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-01 15:19:40 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-01 15:19:40 +0000
commitb2fcd0e0c8850eda2135b6fe270af5f453682f23 (patch)
tree2858497a3551d59093a5dfd233bf3550d40a4e8d /net/proxy/multi_threaded_proxy_resolver.cc
parent087a03f6aeded6397081304e191b1ac027b8e134 (diff)
downloadchromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.zip
chromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.tar.gz
chromium_src-b2fcd0e0c8850eda2135b6fe270af5f453682f23.tar.bz2
Update NetLog to be threadsafe.
The ChromeNetLog is now owned by the browser process, and passed to the IOThread on creation. NetLog entries can be added from any thread. Observers must be able to handle having log entries added from any thread. Observers can add/remove themselves on any thread. BUG=63334 TEST=None, yet Review URL: http://codereview.chromium.org/4118004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/multi_threaded_proxy_resolver.cc')
-rw-r--r--net/proxy/multi_threaded_proxy_resolver.cc20
1 files changed, 4 insertions, 16 deletions
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index d696438a1..a373c1a 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -8,8 +8,8 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/thread.h"
-#include "net/base/capturing_net_log.h"
#include "net/base/net_errors.h"
+#include "net/base/net_log.h"
#include "net/proxy/proxy_info.h"
// TODO(eroman): Have the MultiThreadedProxyResolver clear its PAC script
@@ -253,13 +253,9 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
// Runs on the worker thread.
virtual void Run(MessageLoop* origin_loop) {
- const size_t kNetLogBound = 50u;
- worker_log_.reset(new CapturingNetLog(kNetLogBound));
- BoundNetLog bound_worker_log(NetLog::Source(), worker_log_.get());
-
ProxyResolver* resolver = executor()->resolver();
int rv = resolver->GetProxyForURL(
- url_, &results_buf_, NULL, NULL, bound_worker_log);
+ url_, &results_buf_, NULL, NULL, net_log_);
DCHECK_NE(rv, ERR_IO_PENDING);
origin_loop->PostTask(
@@ -272,12 +268,6 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
void QueryComplete(int result_code) {
// The Job may have been cancelled after it was started.
if (!was_cancelled()) {
- // Merge the load log that was generated on the worker thread, into the
- // main log.
- CapturingBoundNetLog bound_worker_log(NetLog::Source(),
- worker_log_.release());
- bound_worker_log.AppendTo(net_log_);
-
if (result_code >= OK) { // Note: unit-tests use values > 0.
results_->Use(results_buf_);
}
@@ -288,16 +278,14 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
// Must only be used on the "origin" thread.
ProxyInfo* results_;
+
+ // Can be used on either "origin" or worker thread.
BoundNetLog net_log_;
const GURL url_;
// Usable from within DoQuery on the worker thread.
ProxyInfo results_buf_;
- // Used to pass the captured events between DoQuery [worker thread] and
- // QueryComplete [origin thread].
- scoped_ptr<CapturingNetLog> worker_log_;
-
bool was_waiting_for_thread_;
};