OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/stats_collection_controller.h" | 5 #include "content/renderer/stats_collection_controller.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // static | 74 // static |
75 gin::WrapperInfo StatsCollectionController::kWrapperInfo = { | 75 gin::WrapperInfo StatsCollectionController::kWrapperInfo = { |
76 gin::kEmbedderNativeGin | 76 gin::kEmbedderNativeGin |
77 }; | 77 }; |
78 | 78 |
79 // static | 79 // static |
80 void StatsCollectionController::Install(blink::WebFrame* frame) { | 80 void StatsCollectionController::Install(blink::WebFrame* frame) { |
81 v8::Isolate* isolate = blink::mainThreadIsolate(); | 81 v8::Isolate* isolate = blink::mainThreadIsolate(); |
82 v8::HandleScope handle_scope(isolate); | 82 v8::HandleScope handle_scope(isolate); |
83 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 83 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
84 if (context.IsEmpty()) | 84 if (context.IsEmpty()) |
85 return; | 85 return; |
86 | 86 |
87 v8::Context::Scope context_scope(context); | 87 v8::Context::Scope context_scope(context); |
88 | 88 |
89 gin::Handle<StatsCollectionController> controller = | 89 gin::Handle<StatsCollectionController> controller = |
90 gin::CreateHandle(isolate, new StatsCollectionController()); | 90 gin::CreateHandle(isolate, new StatsCollectionController()); |
91 if (controller.IsEmpty()) | 91 if (controller.IsEmpty()) |
92 return; | 92 return; |
93 v8::Handle<v8::Object> global = context->Global(); | 93 v8::Local<v8::Object> global = context->Global(); |
94 global->Set(gin::StringToV8(isolate, "statsCollectionController"), | 94 global->Set(gin::StringToV8(isolate, "statsCollectionController"), |
95 controller.ToV8()); | 95 controller.ToV8()); |
96 } | 96 } |
97 | 97 |
98 StatsCollectionController::StatsCollectionController() {} | 98 StatsCollectionController::StatsCollectionController() {} |
99 | 99 |
100 StatsCollectionController::~StatsCollectionController() {} | 100 StatsCollectionController::~StatsCollectionController() {} |
101 | 101 |
102 gin::ObjectTemplateBuilder StatsCollectionController::GetObjectTemplateBuilder( | 102 gin::ObjectTemplateBuilder StatsCollectionController::GetObjectTemplateBuilder( |
103 v8::Isolate* isolate) { | 103 v8::Isolate* isolate) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 std::string tab_timing_json; | 153 std::string tab_timing_json; |
154 ConvertLoadTimeToJSON( | 154 ConvertLoadTimeToJSON( |
155 observer->load_start_time(), observer->load_stop_time(), | 155 observer->load_start_time(), observer->load_stop_time(), |
156 &tab_timing_json); | 156 &tab_timing_json); |
157 return tab_timing_json; | 157 return tab_timing_json; |
158 } | 158 } |
159 | 159 |
160 } // namespace content | 160 } // namespace content |
OLD | NEW |