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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 996843002: Add profiling to WebContentsImpl::OnDidStopLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/process/process.h" 13 #include "base/process/process.h"
14 #include "base/profiler/scoped_tracker.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "content/browser/accessibility/accessibility_mode_helper.h" 21 #include "content/browser/accessibility/accessibility_mode_helper.h"
21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 22 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
22 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 23 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
23 #include "content/browser/browser_plugin/browser_plugin_guest.h" 24 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 rfh->frame_tree_node()->set_is_loading(true); 2932 rfh->frame_tree_node()->set_is_loading(true);
2932 2933
2933 // Notify the RenderFrameHostManager of the event. 2934 // Notify the RenderFrameHostManager of the event.
2934 rfh->frame_tree_node()->render_manager()->OnDidStartLoading(); 2935 rfh->frame_tree_node()->render_manager()->OnDidStartLoading();
2935 2936
2936 loading_progresses_[render_frame_id] = kMinimumLoadingProgress; 2937 loading_progresses_[render_frame_id] = kMinimumLoadingProgress;
2937 SendLoadProgressChanged(); 2938 SendLoadProgressChanged();
2938 } 2939 }
2939 2940
2940 void WebContentsImpl::OnDidStopLoading() { 2941 void WebContentsImpl::OnDidStopLoading() {
2942 // TODO(erikchen): Remove ScopedTracker below once crbug.com/465796 is
2943 // fixed.
2944 tracked_objects::ScopedTracker tracking_profile1(
2945 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2946 "465796 WebContentsImpl::OnDidStopLoading::Start"));
2947
2941 if (!HasValidFrameSource()) 2948 if (!HasValidFrameSource())
2942 return; 2949 return;
2943 2950
2944 RenderFrameHostImpl* rfh = 2951 RenderFrameHostImpl* rfh =
2945 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); 2952 static_cast<RenderFrameHostImpl*>(render_frame_message_source_);
2946 int64 render_frame_id = rfh->frame_tree_node()->frame_tree_node_id(); 2953 int64 render_frame_id = rfh->frame_tree_node()->frame_tree_node_id();
2947 rfh->frame_tree_node()->set_is_loading(false); 2954 rfh->frame_tree_node()->set_is_loading(false);
2948 2955
2949 if (loading_progresses_.find(render_frame_id) != loading_progresses_.end()) { 2956 if (loading_progresses_.find(render_frame_id) != loading_progresses_.end()) {
2957 // TODO(erikchen): Remove ScopedTracker below once crbug.com/465796 is
2958 // fixed.
2959 tracked_objects::ScopedTracker tracking_profile2(
2960 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2961 "465796 "
2962 "WebContentsImpl::OnDidStopLoading::SendLoadProgressChanged"));
2963
2950 // Load stopped while we were still tracking load. Make sure we update 2964 // Load stopped while we were still tracking load. Make sure we update
2951 // progress based on this frame's completion. 2965 // progress based on this frame's completion.
2952 loading_progresses_[render_frame_id] = 1.0; 2966 loading_progresses_[render_frame_id] = 1.0;
2953 SendLoadProgressChanged(); 2967 SendLoadProgressChanged();
2954 // Then we clean-up our states. 2968 // Then we clean-up our states.
2955 if (loading_total_progress_ == 1.0) 2969 if (loading_total_progress_ == 1.0)
2956 ResetLoadProgressState(); 2970 ResetLoadProgressState();
2957 } 2971 }
2958 2972
2973 // TODO(erikchen): Remove ScopedTracker below once crbug.com/465796 is
2974 // fixed.
2975 tracked_objects::ScopedTracker tracking_profile3(
2976 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2977 "465796 WebContentsImpl::OnDidStopLoading::NotifyRenderManager"));
2959 // Notify the RenderFrameHostManager of the event. 2978 // Notify the RenderFrameHostManager of the event.
2960 rfh->frame_tree_node()->render_manager()->OnDidStopLoading(); 2979 rfh->frame_tree_node()->render_manager()->OnDidStopLoading();
2961 2980
2962 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes 2981 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes
2963 // calls DidStopLoading() without a matching DidStartLoading(). 2982 // calls DidStopLoading() without a matching DidStartLoading().
2964 if (loading_frames_in_progress_ == 0) 2983 if (loading_frames_in_progress_ == 0)
2965 return; 2984 return;
2985
2986 // TODO(erikchen): Remove ScopedTracker below once crbug.com/465796 is
2987 // fixed.
2988 tracked_objects::ScopedTracker tracking_profile4(
2989 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2990 "465796 WebContentsImpl::OnDidStopLoading::PDFDidStopLoading"));
2966 --loading_frames_in_progress_; 2991 --loading_frames_in_progress_;
2967 if (loading_frames_in_progress_ == 0) 2992 if (loading_frames_in_progress_ == 0)
2968 DidStopLoading(rfh); 2993 DidStopLoading(rfh);
2969 } 2994 }
2970 2995
2971 void WebContentsImpl::OnDidChangeLoadProgress(double load_progress) { 2996 void WebContentsImpl::OnDidChangeLoadProgress(double load_progress) {
2972 if (!HasValidFrameSource()) 2997 if (!HasValidFrameSource())
2973 return; 2998 return;
2974 2999
2975 RenderFrameHostImpl* rfh = 3000 RenderFrameHostImpl* rfh =
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
4585 node->render_manager()->ResumeResponseDeferredAtStart(); 4610 node->render_manager()->ResumeResponseDeferredAtStart();
4586 } 4611 }
4587 4612
4588 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4613 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4589 force_disable_overscroll_content_ = force_disable; 4614 force_disable_overscroll_content_ = force_disable;
4590 if (view_) 4615 if (view_)
4591 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4616 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4592 } 4617 }
4593 4618
4594 } // namespace content 4619 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698