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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nits Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 render_frame_host_(nullptr), 58 render_frame_host_(nullptr),
59 is_same_page_(false), 59 is_same_page_(false),
60 is_synchronous_(is_synchronous), 60 is_synchronous_(is_synchronous),
61 is_srcdoc_(is_srcdoc), 61 is_srcdoc_(is_srcdoc),
62 was_redirected_(false), 62 was_redirected_(false),
63 state_(INITIAL), 63 state_(INITIAL),
64 is_transferring_(false), 64 is_transferring_(false),
65 frame_tree_node_(frame_tree_node), 65 frame_tree_node_(frame_tree_node),
66 next_index_(0), 66 next_index_(0),
67 navigation_start_(navigation_start), 67 navigation_start_(navigation_start),
68 pending_nav_entry_id_(pending_nav_entry_id) { 68 pending_nav_entry_id_(pending_nav_entry_id),
69 is_using_lofi_(false),
70 used_data_reduction_proxy_(false) {
69 DCHECK(!navigation_start.is_null()); 71 DCHECK(!navigation_start.is_null());
70 GetDelegate()->DidStartNavigation(this); 72 GetDelegate()->DidStartNavigation(this);
71 } 73 }
72 74
73 NavigationHandleImpl::~NavigationHandleImpl() { 75 NavigationHandleImpl::~NavigationHandleImpl() {
74 GetDelegate()->DidFinishNavigation(this); 76 GetDelegate()->DidFinishNavigation(this);
75 77
76 // Cancel the navigation on the IO thread if the NavigationHandle is being 78 // Cancel the navigation on the IO thread if the NavigationHandle is being
77 // destroyed in the middle of the NavigationThrottles checks. 79 // destroyed in the middle of the NavigationThrottles checks.
78 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) 80 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 WillRedirectRequest(new_url, new_method_is_post, new_referrer_url, 252 WillRedirectRequest(new_url, new_method_is_post, new_referrer_url,
251 new_is_external_protocol, 253 new_is_external_protocol,
252 scoped_refptr<net::HttpResponseHeaders>(), 254 scoped_refptr<net::HttpResponseHeaders>(),
253 base::Bind(&UpdateThrottleCheckResult, &result)); 255 base::Bind(&UpdateThrottleCheckResult, &result));
254 256
255 // Reset the callback to ensure it will not be called later. 257 // Reset the callback to ensure it will not be called later.
256 complete_callback_.Reset(); 258 complete_callback_.Reset();
257 return result; 259 return result;
258 } 260 }
259 261
262 bool NavigationHandleImpl::IsUsingLofi() const {
263 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE);
264 return is_using_lofi_;
265 }
266
267 bool NavigationHandleImpl::UsedDataReductionProxy() const {
268 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE);
269 return used_data_reduction_proxy_;
270 }
271
260 void NavigationHandleImpl::InitServiceWorkerHandle( 272 void NavigationHandleImpl::InitServiceWorkerHandle(
261 ServiceWorkerContextWrapper* service_worker_context) { 273 ServiceWorkerContextWrapper* service_worker_context) {
262 DCHECK(IsBrowserSideNavigationEnabled()); 274 DCHECK(IsBrowserSideNavigationEnabled());
263 service_worker_handle_.reset( 275 service_worker_handle_.reset(
264 new ServiceWorkerNavigationHandle(service_worker_context)); 276 new ServiceWorkerNavigationHandle(service_worker_context));
265 } 277 }
266 278
267 void NavigationHandleImpl::WillStartRequest( 279 void NavigationHandleImpl::WillStartRequest(
268 bool is_post, 280 bool is_post,
269 const Referrer& sanitized_referrer, 281 const Referrer& sanitized_referrer,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 RenderFrameHostImpl* render_frame_host) { 382 RenderFrameHostImpl* render_frame_host) {
371 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); 383 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host);
372 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); 384 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node());
373 CHECK_EQ(url_, params.url); 385 CHECK_EQ(url_, params.url);
374 386
375 is_post_ = params.is_post; 387 is_post_ = params.is_post;
376 has_user_gesture_ = (params.gesture == NavigationGestureUser); 388 has_user_gesture_ = (params.gesture == NavigationGestureUser);
377 transition_ = params.transition; 389 transition_ = params.transition;
378 render_frame_host_ = render_frame_host; 390 render_frame_host_ = render_frame_host;
379 is_same_page_ = same_page; 391 is_same_page_ = same_page;
392 is_using_lofi_ = params.is_using_lofi;
393 used_data_reduction_proxy_ = params.used_data_reduction_proxy;
380 394
381 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; 395 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
382 } 396 }
383 397
384 NavigationThrottle::ThrottleCheckResult 398 NavigationThrottle::ThrottleCheckResult
385 NavigationHandleImpl::CheckWillStartRequest() { 399 NavigationHandleImpl::CheckWillStartRequest() {
386 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); 400 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START);
387 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); 401 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0);
388 DCHECK(state_ != DEFERRING_START || next_index_ != 0); 402 DCHECK(state_ != DEFERRING_START || next_index_ != 0);
389 for (size_t i = next_index_; i < throttles_.size(); ++i) { 403 for (size_t i = next_index_; i < throttles_.size(); ++i) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 complete_callback_.Reset(); 498 complete_callback_.Reset();
485 499
486 if (!callback.is_null()) 500 if (!callback.is_null())
487 callback.Run(result); 501 callback.Run(result);
488 502
489 // No code after running the callback, as it might have resulted in our 503 // No code after running the callback, as it might have resulted in our
490 // destruction. 504 // destruction.
491 } 505 }
492 506
493 } // namespace content 507 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698