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

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

Issue 2222573003: Add use counter for chrome.loadTimes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.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) 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 "chrome/renderer/loadtimes_extension_bindings.h" 5 #include "chrome/renderer/loadtimes_extension_bindings.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return kTransitionReload; 102 return kTransitionReload;
103 case blink::WebNavigationTypeOther: 103 case blink::WebNavigationTypeOther:
104 return kTransitionOther; 104 return kTransitionOther;
105 } 105 }
106 return kTransitionOther; 106 return kTransitionOther;
107 } 107 }
108 108
109 static void LoadtimesGetter( 109 static void LoadtimesGetter(
110 v8::Local<v8::Name> name, 110 v8::Local<v8::Name> name,
111 const v8::PropertyCallbackInfo<v8::Value>& info) { 111 const v8::PropertyCallbackInfo<v8::Value>& info) {
112 // TODO(panicker): Add Usage counter. 112 if (WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext()) {
113 frame->usageCountChromeLoadTimes(blink::WebString::fromUTF8(
114 *v8::String::Utf8Value(name)));
115 }
113 info.GetReturnValue().Set(info.Data()); 116 info.GetReturnValue().Set(info.Data());
114 } 117 }
115 118
116 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) { 119 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) {
117 args.GetReturnValue().SetNull(); 120 args.GetReturnValue().SetNull();
118 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); 121 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
119 if (!frame) { 122 if (!frame) {
120 return; 123 return;
121 } 124 }
122 WebDataSource* data_source = frame->dataSource(); 125 WebDataSource* data_source = frame->dataSource();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 394 }
392 args.GetReturnValue().Set(csi); 395 args.GetReturnValue().Set(csi);
393 } 396 }
394 }; 397 };
395 398
396 v8::Extension* LoadTimesExtension::Get() { 399 v8::Extension* LoadTimesExtension::Get() {
397 return new LoadTimesExtensionWrapper(); 400 return new LoadTimesExtensionWrapper();
398 } 401 }
399 402
400 } // namespace extensions_v8 403 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698