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

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: Rebase. 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.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 // For the trace below we're using the NavigationURLLoaderImplCore as the
clamy 2015/12/22 10:55:24 nit: skip one line above comment.
carlosk 2015/12/22 13:58:18 Done.
30 // async trace id, |navigation_start| as the timestamp and reporting the
31 // FrameTreeNode id as a parameter.
32 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(
33 "navigation", "Navigation timeToResponseStarted", core_,
34 request_info->common_params.navigation_start.ToInternalValue(),
35 "FrameTreeNode id", request_info->frame_tree_node_id);
28 ServiceWorkerNavigationHandleCore* service_worker_handle_core = 36 ServiceWorkerNavigationHandleCore* service_worker_handle_core =
29 service_worker_handle ? service_worker_handle->core() : nullptr; 37 service_worker_handle ? service_worker_handle->core() : nullptr;
30 BrowserThread::PostTask( 38 BrowserThread::PostTask(
31 BrowserThread::IO, FROM_HERE, 39 BrowserThread::IO, FROM_HERE,
32 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), 40 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_),
33 browser_context->GetResourceContext(), 41 browser_context->GetResourceContext(),
34 service_worker_handle_core, base::Passed(&request_info))); 42 service_worker_handle_core, base::Passed(&request_info)));
35 } 43 }
36 44
37 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { 45 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 delegate_->OnRequestFailed(in_cache, net_error); 81 delegate_->OnRequestFailed(in_cache, net_error);
74 } 82 }
75 83
76 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { 84 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) {
77 DCHECK_CURRENTLY_ON(BrowserThread::UI); 85 DCHECK_CURRENTLY_ON(BrowserThread::UI);
78 86
79 delegate_->OnRequestStarted(timestamp); 87 delegate_->OnRequestStarted(timestamp);
80 } 88 }
81 89
82 } // namespace content 90 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698