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

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

Issue 1532873003: PlzNavigate: add initial traces for new TBM benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed crash issue for synchronous navigations. Created 4 years, 12 months 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.h" 5 #include "content/browser/loader/navigation_url_loader_impl.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/trace_event/trace_event.h"
9 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
10 #include "content/browser/loader/navigation_url_loader_delegate.h" 11 #include "content/browser/loader/navigation_url_loader_delegate.h"
11 #include "content/browser/loader/navigation_url_loader_impl_core.h" 12 #include "content/browser/loader/navigation_url_loader_impl_core.h"
12 #include "content/browser/service_worker/service_worker_navigation_handle.h" 13 #include "content/browser/service_worker/service_worker_navigation_handle.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/stream_handle.h" 16 #include "content/public/browser/stream_handle.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 NavigationURLLoaderImpl::NavigationURLLoaderImpl( 20 NavigationURLLoaderImpl::NavigationURLLoaderImpl(
20 BrowserContext* browser_context, 21 BrowserContext* browser_context,
21 scoped_ptr<NavigationRequestInfo> request_info, 22 scoped_ptr<NavigationRequestInfo> request_info,
22 ServiceWorkerNavigationHandle* service_worker_handle, 23 ServiceWorkerNavigationHandle* service_worker_handle,
23 NavigationURLLoaderDelegate* delegate) 24 NavigationURLLoaderDelegate* delegate)
24 : delegate_(delegate), weak_factory_(this) { 25 : delegate_(delegate), weak_factory_(this) {
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); 26 DCHECK_CURRENTLY_ON(BrowserThread::UI);
26 27
27 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); 28 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr());
29
30 // TODO(carlosk): extend this trace to support non-PlzNavigate navigations.
31 // For the trace below we're using the NavigationURLLoaderImplCore as the
32 // async trace id, |navigation_start| as the timestamp and reporting the
33 // FrameTreeNode id as a parameter.
34 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(
35 "navigation", "Navigation timeToResponseStarted", core_,
36 request_info->common_params.navigation_start.ToInternalValue(),
37 "FrameTreeNode id", request_info->frame_tree_node_id);
28 ServiceWorkerNavigationHandleCore* service_worker_handle_core = 38 ServiceWorkerNavigationHandleCore* service_worker_handle_core =
29 service_worker_handle ? service_worker_handle->core() : nullptr; 39 service_worker_handle ? service_worker_handle->core() : nullptr;
30 BrowserThread::PostTask( 40 BrowserThread::PostTask(
31 BrowserThread::IO, FROM_HERE, 41 BrowserThread::IO, FROM_HERE,
32 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), 42 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_),
33 browser_context->GetResourceContext(), 43 browser_context->GetResourceContext(),
34 service_worker_handle_core, base::Passed(&request_info))); 44 service_worker_handle_core, base::Passed(&request_info)));
35 } 45 }
36 46
37 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { 47 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 delegate_->OnRequestFailed(in_cache, net_error); 83 delegate_->OnRequestFailed(in_cache, net_error);
74 } 84 }
75 85
76 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { 86 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) {
77 DCHECK_CURRENTLY_ON(BrowserThread::UI); 87 DCHECK_CURRENTLY_ON(BrowserThread::UI);
78 88
79 delegate_->OnRequestStarted(timestamp); 89 delegate_->OnRequestStarted(timestamp);
80 } 90 }
81 91
82 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/loader/navigation_url_loader_impl_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698