OLD | NEW |
---|---|
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 Loading... | |
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 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); |
113 if (frame) { | |
esprehn
2016/08/05 20:57:36
I'd usually write:
if (WebLocalFrame* frame = Web
panicker
2016/08/05 23:06:14
Sure, updated.
| |
114 frame->usageCountChromeLoadtimes(blink::WebString::fromUTF8( | |
115 *v8::String::Utf8Value(name))); | |
116 } | |
113 info.GetReturnValue().Set(info.Data()); | 117 info.GetReturnValue().Set(info.Data()); |
114 } | 118 } |
115 | 119 |
116 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) { | 120 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) { |
117 args.GetReturnValue().SetNull(); | 121 args.GetReturnValue().SetNull(); |
118 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); | 122 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); |
119 if (!frame) { | 123 if (!frame) { |
120 return; | 124 return; |
121 } | 125 } |
122 WebDataSource* data_source = frame->dataSource(); | 126 WebDataSource* data_source = frame->dataSource(); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 } | 395 } |
392 args.GetReturnValue().Set(csi); | 396 args.GetReturnValue().Set(csi); |
393 } | 397 } |
394 }; | 398 }; |
395 | 399 |
396 v8::Extension* LoadTimesExtension::Get() { | 400 v8::Extension* LoadTimesExtension::Get() { |
397 return new LoadTimesExtensionWrapper(); | 401 return new LoadTimesExtensionWrapper(); |
398 } | 402 } |
399 | 403 |
400 } // namespace extensions_v8 | 404 } // namespace extensions_v8 |
OLD | NEW |