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

Unified Diff: net/proxy/single_threaded_proxy_resolver.cc

Issue 363025: Improve the display of LoadLogs when truncation occurs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Change -1 to be a constant instead Created 11 years, 1 month 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 | « net/proxy/proxy_service_unittest.cc ('k') | net/proxy/single_threaded_proxy_resolver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/single_threaded_proxy_resolver.cc
===================================================================
--- net/proxy/single_threaded_proxy_resolver.cc (revision 31195)
+++ net/proxy/single_threaded_proxy_resolver.cc (working copy)
@@ -125,9 +125,12 @@
void Start() {
is_started_ = true;
+ size_t load_log_bound = load_log_ ? load_log_->max_num_entries() : 0;
+
coordinator_->thread()->message_loop()->PostTask(
FROM_HERE, NewRunnableMethod(this, &Job::DoQuery,
- coordinator_->resolver_.get()));
+ coordinator_->resolver_.get(),
+ load_log_bound));
}
bool is_started() const { return is_started_; }
@@ -149,9 +152,12 @@
~Job() {}
// Runs on the worker thread.
- void DoQuery(ProxyResolver* resolver) {
- LoadLog* worker_log = new LoadLog;
- worker_log->AddRef(); // Balanced in QueryComplete.
+ void DoQuery(ProxyResolver* resolver, size_t load_log_bound) {
+ LoadLog* worker_log = NULL;
+ if (load_log_bound > 0) {
+ worker_log = new LoadLog(load_log_bound);
+ worker_log->AddRef(); // Balanced in QueryComplete.
+ }
int rv = resolver->GetProxyForURL(url_, &results_buf_, NULL, NULL,
worker_log);
@@ -165,9 +171,11 @@
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();
+ if (worker_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()) {
« no previous file with comments | « net/proxy/proxy_service_unittest.cc ('k') | net/proxy/single_threaded_proxy_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698