diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 21:27:00 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 21:27:00 +0000 |
commit | 52ae80c40de68f97f535d718fbbc086d5698c870 (patch) | |
tree | 775060ff843b19b6c589cd1395aaf42bf766f190 /net/proxy/single_threaded_proxy_resolver.cc | |
parent | e7de7b8167ec1e264e15780bd7a2fb3f40a7138d (diff) | |
download | chromium_src-52ae80c40de68f97f535d718fbbc086d5698c870.zip chromium_src-52ae80c40de68f97f535d718fbbc086d5698c870.tar.gz chromium_src-52ae80c40de68f97f535d718fbbc086d5698c870.tar.bz2 |
Add trace points for the "dnsResolve()" and "myIpAddress()" PAC javascript bindings.
This makes note of the calls in the request's LoadLog.
Since the LoadLog is not thread-safe, SingleThreadedProxyResolver creates a private LoadLog for ProxyResolverV8 to write into, and then copies it into the mainLoadLog on completion (on the origin thread).
BUG=http://crbug.com/14478
Review URL: http://codereview.chromium.org/193037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/single_threaded_proxy_resolver.cc')
-rw-r--r-- | net/proxy/single_threaded_proxy_resolver.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/net/proxy/single_threaded_proxy_resolver.cc b/net/proxy/single_threaded_proxy_resolver.cc index 02658a6..01c35fa 100644 --- a/net/proxy/single_threaded_proxy_resolver.cc +++ b/net/proxy/single_threaded_proxy_resolver.cc @@ -5,6 +5,7 @@ #include "net/proxy/single_threaded_proxy_resolver.h" #include "base/thread.h" +#include "net/base/load_log.h" #include "net/base/net_errors.h" #include "net/proxy/proxy_info.h" @@ -94,10 +95,12 @@ class SingleThreadedProxyResolver::Job Job(SingleThreadedProxyResolver* coordinator, const GURL& url, ProxyInfo* results, - CompletionCallback* callback) + CompletionCallback* callback, + LoadLog* load_log) : coordinator_(coordinator), callback_(callback), results_(results), + load_log_(load_log), url_(url), is_started_(false), origin_loop_(MessageLoop::current()) { @@ -130,14 +133,24 @@ class SingleThreadedProxyResolver::Job private: // Runs on the worker thread. void DoQuery(ProxyResolver* resolver) { - int rv = resolver->GetProxyForURL(url_, &results_buf_, NULL, NULL); + scoped_refptr<LoadLog> worker_log(new LoadLog); + int rv = resolver->GetProxyForURL(url_, &results_buf_, NULL, NULL, + worker_log); DCHECK_NE(rv, ERR_IO_PENDING); + + worker_log->AddRef(); // Balanced in QueryComplete. origin_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &Job::QueryComplete, rv)); + NewRunnableMethod(this, &Job::QueryComplete, rv, worker_log)); } // Runs the completion callback on the origin thread. - void QueryComplete(int result_code) { + void QueryComplete(int result_code, LoadLog* worker_log) { + // Merge the load log that was generated on the worker thread, into the + // main log. + if (load_log_) + load_log_->Append(worker_log); + worker_log->Release(); + // The Job may have been cancelled after it was started. if (!was_cancelled()) { if (result_code >= OK) { // Note: unit-tests use values > 0. @@ -159,6 +172,7 @@ class SingleThreadedProxyResolver::Job SingleThreadedProxyResolver* coordinator_; CompletionCallback* callback_; ProxyInfo* results_; + scoped_refptr<LoadLog> load_log_; GURL url_; bool is_started_; @@ -193,10 +207,11 @@ SingleThreadedProxyResolver::~SingleThreadedProxyResolver() { int SingleThreadedProxyResolver::GetProxyForURL(const GURL& url, ProxyInfo* results, CompletionCallback* callback, - RequestHandle* request) { + RequestHandle* request, + LoadLog* load_log) { DCHECK(callback); - scoped_refptr<Job> job = new Job(this, url, results, callback); + scoped_refptr<Job> job = new Job(this, url, results, callback, load_log); pending_jobs_.push_back(job); ProcessPendingJobs(); // Jobs can never finish synchronously. |