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

Unified 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: Changing lifetime of NavigationSupportsUserData for Draft 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 05a6a947aa783bfdd0f5ef0c3cee5da09ad343f7..99623620861fa27dbbd13e2b521c5cfba406775f 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -1,19 +1,21 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/frame_host/navigation_handle_impl.h"
#include <utility>
+#include "base/supports_user_data.h"
#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/frame_host/navigation_user_data.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/navigator_delegate.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_navigation_handle.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_client.h"
#include "net/url_request/redirect_info.h"
@@ -58,21 +60,22 @@ NavigationHandleImpl::NavigationHandleImpl(
render_frame_host_(nullptr),
is_same_page_(false),
is_synchronous_(is_synchronous),
is_srcdoc_(is_srcdoc),
was_redirected_(false),
state_(INITIAL),
is_transferring_(false),
frame_tree_node_(frame_tree_node),
next_index_(0),
navigation_start_(navigation_start),
- pending_nav_entry_id_(pending_nav_entry_id) {
+ pending_nav_entry_id_(pending_nav_entry_id),
+ navigation_supports_user_data_(nullptr) {
DCHECK(!navigation_start.is_null());
GetDelegate()->DidStartNavigation(this);
}
NavigationHandleImpl::~NavigationHandleImpl() {
GetDelegate()->DidFinishNavigation(this);
// Cancel the navigation on the IO thread if the NavigationHandle is being
// destroyed in the middle of the NavigationThrottles checks.
if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null())
@@ -483,11 +486,24 @@ void NavigationHandleImpl::RunCompleteCallback(
ThrottleChecksFinishedCallback callback = complete_callback_;
complete_callback_.Reset();
if (!callback.is_null())
callback.Run(result);
// No code after running the callback, as it might have resulted in our
// destruction.
}
+void NavigationHandleImpl::SetNavigationSupportsUserData(
+ scoped_ptr<NavigationSupportsUserData> navigation_supports_user_data) {
+ DCHECK(!navigation_supports_user_data_.get());
+ navigation_supports_user_data_ = std::move(navigation_supports_user_data);
+}
+
+base::SupportsUserData::Data* NavigationHandleImpl::GetUserData(
+ const void* key) {
+ if (navigation_supports_user_data_.get())
+ return navigation_supports_user_data_->GetUserData(key);
+ return nullptr;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698