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 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 Loading... |
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 |
OLD | NEW |