| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The LoadTimesExtension is a v8 extension to access the time it took | 5 // The LoadTimesExtension is a v8 extension to access the time it took |
| 6 // to load a page. | 6 // to load a page. |
| 7 | 7 |
| 8 #ifndef CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ | 8 #ifndef CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ |
| 9 #define CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ | 9 #define CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ |
| 10 | 10 |
| 11 namespace v8 { | 11 #include "content/public/renderer/render_frame_observer.h" |
| 12 class Extension; | 12 #include "gin/wrappable.h" |
| 13 #include "v8/include/v8.h" |
| 14 |
| 15 namespace blink { |
| 16 class WebFrame; |
| 13 } | 17 } |
| 14 | 18 |
| 15 namespace extensions_v8 { | 19 namespace extensions_v8 { |
| 16 | 20 |
| 17 class LoadTimesExtension { | 21 class LoadTimesExtensionHelper : public content::RenderFrameObserver { |
| 18 public: | 22 public: |
| 19 static v8::Extension* Get(); | 23 explicit LoadTimesExtensionHelper(content::RenderFrame* render_frame); |
| 24 |
| 25 // RenderFrameObserver: |
| 26 void DidFinishLoad() override; |
| 27 }; |
| 28 |
| 29 class LoadTimesExtension : public gin::Wrappable<LoadTimesExtension> { |
| 30 public: |
| 31 static gin::WrapperInfo kWrapperInfo; |
| 32 |
| 33 static void Install(blink::WebFrame* frame); |
| 34 |
| 35 private: |
| 36 // gin::Wrappable: |
| 37 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 38 v8::Isolate* isolate) override; |
| 39 |
| 40 // Returns an object containing the following members: |
| 41 // requestTime: The time the request to load the page was received. |
| 42 // loadTime: The time the renderer started the load process. |
| 43 // finishDocumentLoadTime: The time the document itself was loaded |
| 44 // (this is before the onload() method is fired). |
| 45 // finishLoadTime: The time all loading is done, after the onload() |
| 46 // method and all resources. |
| 47 // navigationType: A string describing what user action initiated the |
| 48 // load. |
| 49 v8::Local<v8::Object> LoadTimes(); |
| 50 |
| 51 // Returns an object containing the following members: |
| 52 // startE: The time the request to load the page was received. |
| 53 // onloadT: The time the page finished loading. |
| 54 // pageT: Elapsed time to load the page. |
| 55 // tran: Page navigation type. |
| 56 v8::Local<v8::Object> CSI(); |
| 20 }; | 57 }; |
| 21 | 58 |
| 22 } // namespace extensions_v8 | 59 } // namespace extensions_v8 |
| 23 | 60 |
| 24 #endif // CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ | 61 #endif // CHROME_RENDERER_LOADTIMES_EXTENSION_BINDINGS_H_ |
| OLD | NEW |