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

Side by Side Diff: chrome/renderer/page_load_histograms.cc

Issue 7645015: Rip out code for logging cross-frame property accesses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/page_load_histograms.h ('k') | content/renderer/render_view.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/renderer/page_load_histograms.h" 5 #include "chrome/renderer/page_load_histograms.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 764
765 void PageLoadHistograms::ResetCrossFramePropertyAccess() { 765 void PageLoadHistograms::ResetCrossFramePropertyAccess() {
766 cross_origin_access_count_ = 0; 766 cross_origin_access_count_ = 0;
767 same_origin_access_count_ = 0; 767 same_origin_access_count_ = 0;
768 } 768 }
769 769
770 void PageLoadHistograms::FrameWillClose(WebFrame* frame) { 770 void PageLoadHistograms::FrameWillClose(WebFrame* frame) {
771 Dump(frame); 771 Dump(frame);
772 } 772 }
773 773
774 void PageLoadHistograms::LogCrossFramePropertyAccess(
775 WebFrame* frame,
776 WebFrame* target,
777 bool cross_origin,
778 const WebString& property_name,
779 unsigned long long event_id) {
780 // TODO(johnnyg): track the individual properties and repeat event_ids.
781 if (cross_origin)
782 cross_origin_access_count_++;
783 else
784 same_origin_access_count_++;
785 }
786
787 bool PageLoadHistograms::OnMessageReceived(const IPC::Message& message) { 774 bool PageLoadHistograms::OnMessageReceived(const IPC::Message& message) {
788 if (message.type() == ViewMsg_ClosePage::ID) { 775 if (message.type() == ViewMsg_ClosePage::ID) {
789 // TODO(davemoore) This code should be removed once willClose() gets 776 // TODO(davemoore) This code should be removed once willClose() gets
790 // called when a page is destroyed. page_load_histograms_.Dump() is safe 777 // called when a page is destroyed. page_load_histograms_.Dump() is safe
791 // to call multiple times for the same frame, but it will simplify things. 778 // to call multiple times for the same frame, but it will simplify things.
792 Dump(render_view()->webview()->mainFrame()); 779 Dump(render_view()->webview()->mainFrame());
793 ResetCrossFramePropertyAccess(); 780 ResetCrossFramePropertyAccess();
794 } 781 }
795 return false; 782 return false;
796 } 783 }
797 784
798 void PageLoadHistograms::LogPageLoadTime(const NavigationState* state, 785 void PageLoadHistograms::LogPageLoadTime(const NavigationState* state,
799 const WebDataSource* ds) const { 786 const WebDataSource* ds) const {
800 // Because this function gets called on every page load, 787 // Because this function gets called on every page load,
801 // take extra care to optimize it away if logging is turned off. 788 // take extra care to optimize it away if logging is turned off.
802 if (logging::LOG_INFO < logging::GetMinLogLevel()) 789 if (logging::LOG_INFO < logging::GetMinLogLevel())
803 return; 790 return;
804 791
805 DCHECK(state); 792 DCHECK(state);
806 DCHECK(ds); 793 DCHECK(ds);
807 GURL url(ds->request().url()); 794 GURL url(ds->request().url());
808 Time start = state->start_load_time(); 795 Time start = state->start_load_time();
809 Time finish = state->finish_load_time(); 796 Time finish = state->finish_load_time();
810 // TODO(mbelshe): should we log more stats? 797 // TODO(mbelshe): should we log more stats?
811 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 798 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
812 << url.spec(); 799 << url.spec();
813 } 800 }
OLDNEW
« no previous file with comments | « chrome/renderer/page_load_histograms.h ('k') | content/renderer/render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698