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

Side by Side Diff: content/browser/loader/navigation_url_loader_impl_core.cc

Issue 1532873003: PlzNavigate: add initial traces for new TBM benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/navigation_url_loader_impl_core.h" 5 #include "content/browser/loader/navigation_url_loader_impl_core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DCHECK_CURRENTLY_ON(BrowserThread::IO); 58 DCHECK_CURRENTLY_ON(BrowserThread::IO);
59 59
60 if (resource_handler_) 60 if (resource_handler_)
61 resource_handler_->FollowRedirect(); 61 resource_handler_->FollowRedirect();
62 } 62 }
63 63
64 void NavigationURLLoaderImplCore::NotifyRequestRedirected( 64 void NavigationURLLoaderImplCore::NotifyRequestRedirected(
65 const net::RedirectInfo& redirect_info, 65 const net::RedirectInfo& redirect_info,
66 ResourceResponse* response) { 66 ResourceResponse* response) {
67 DCHECK_CURRENTLY_ON(BrowserThread::IO); 67 DCHECK_CURRENTLY_ON(BrowserThread::IO);
68 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
68 69
69 // Make a copy of the ResourceResponse before it is passed to another thread. 70 // Make a copy of the ResourceResponse before it is passed to another thread.
70 // 71 //
71 // TODO(davidben): This copy could be avoided if ResourceResponse weren't 72 // TODO(davidben): This copy could be avoided if ResourceResponse weren't
72 // reference counted and the loader stack passed unique ownership of the 73 // reference counted and the loader stack passed unique ownership of the
73 // response. https://crbug.com/416050 74 // response. https://crbug.com/416050
74 BrowserThread::PostTask( 75 BrowserThread::PostTask(
75 BrowserThread::UI, FROM_HERE, 76 BrowserThread::UI, FROM_HERE,
76 base::Bind(&NavigationURLLoaderImpl::NotifyRequestRedirected, loader_, 77 base::Bind(&NavigationURLLoaderImpl::NotifyRequestRedirected, loader_,
77 redirect_info, response->DeepCopy())); 78 redirect_info, response->DeepCopy()));
79 TRACE_EVENT_ASYNC_BEGIN2(
80 // category and name
81 "navigation", "Navigation redirectDelay",
82 // use this NavigationURLLoaderImplCore instance as the async trace id
83 this,
84 // add this instance address as a parameter
85 "&NavigationURLLoaderImplCore", this,
clamy 2015/12/21 10:43:32 Why the & here? Also as mentioned somewhere else,
carlosk 2015/12/21 11:19:25 Done.
86 // add the redirected URL as a parameter
87 "New URL", redirect_info.new_url.spec());
78 } 88 }
79 89
80 void NavigationURLLoaderImplCore::NotifyResponseStarted( 90 void NavigationURLLoaderImplCore::NotifyResponseStarted(
81 ResourceResponse* response, 91 ResourceResponse* response,
82 scoped_ptr<StreamHandle> body) { 92 scoped_ptr<StreamHandle> body) {
83 DCHECK_CURRENTLY_ON(BrowserThread::IO); 93 DCHECK_CURRENTLY_ON(BrowserThread::IO);
94 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
95 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
96 "&NavigationURLLoaderImplCore", this, "success", true);
84 97
85 // If, by the time the task reaches the UI thread, |loader_| has already been 98 // If, by the time the task reaches the UI thread, |loader_| has already been
86 // destroyed, NotifyResponseStarted will not run. |body| will be destructed 99 // destroyed, NotifyResponseStarted will not run. |body| will be destructed
87 // and the request released at that point. 100 // and the request released at that point.
88 101
89 // Make a copy of the ResourceResponse before it is passed to another thread. 102 // Make a copy of the ResourceResponse before it is passed to another thread.
90 // 103 //
91 // TODO(davidben): This copy could be avoided if ResourceResponse weren't 104 // TODO(davidben): This copy could be avoided if ResourceResponse weren't
92 // reference counted and the loader stack passed unique ownership of the 105 // reference counted and the loader stack passed unique ownership of the
93 // response. https://crbug.com/416050 106 // response. https://crbug.com/416050
94 BrowserThread::PostTask( 107 BrowserThread::PostTask(
95 BrowserThread::UI, FROM_HERE, 108 BrowserThread::UI, FROM_HERE,
96 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_, 109 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_,
97 response->DeepCopy(), base::Passed(&body))); 110 response->DeepCopy(), base::Passed(&body)));
98 } 111 }
99 112
100 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache, 113 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache,
101 int net_error) { 114 int net_error) {
102 DCHECK_CURRENTLY_ON(BrowserThread::IO); 115 DCHECK_CURRENTLY_ON(BrowserThread::IO);
116 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
117 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
118 "&NavigationURLLoaderImplCore", this, "success",
119 false);
103 120
104 BrowserThread::PostTask( 121 BrowserThread::PostTask(
105 BrowserThread::UI, FROM_HERE, 122 BrowserThread::UI, FROM_HERE,
106 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, 123 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_,
107 in_cache, net_error)); 124 in_cache, net_error));
108 } 125 }
109 126
110 } // namespace content 127 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698