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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 v8::Isolate* isolate = blink::mainThreadIsolate(); | 80 v8::Isolate* isolate = blink::mainThreadIsolate(); |
81 v8::HandleScope handle_scope(isolate); | 81 v8::HandleScope handle_scope(isolate); |
82 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 82 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); |
83 if (context.IsEmpty()) | 83 if (context.IsEmpty()) |
84 return; | 84 return; |
85 | 85 |
86 v8::Context::Scope context_scope(context); | 86 v8::Context::Scope context_scope(context); |
87 | 87 |
88 gin::Handle<StatsCollectionController> controller = | 88 gin::Handle<StatsCollectionController> controller = |
89 gin::CreateHandle(isolate, new StatsCollectionController()); | 89 gin::CreateHandle(isolate, new StatsCollectionController()); |
| 90 if (controller.IsEmpty()) |
| 91 return; |
90 v8::Handle<v8::Object> global = context->Global(); | 92 v8::Handle<v8::Object> global = context->Global(); |
91 global->Set(gin::StringToV8(isolate, "statsCollectionController"), | 93 global->Set(gin::StringToV8(isolate, "statsCollectionController"), |
92 controller.ToV8()); | 94 controller.ToV8()); |
93 } | 95 } |
94 | 96 |
95 StatsCollectionController::StatsCollectionController() {} | 97 StatsCollectionController::StatsCollectionController() {} |
96 | 98 |
97 StatsCollectionController::~StatsCollectionController() {} | 99 StatsCollectionController::~StatsCollectionController() {} |
98 | 100 |
99 gin::ObjectTemplateBuilder StatsCollectionController::GetObjectTemplateBuilder( | 101 gin::ObjectTemplateBuilder StatsCollectionController::GetObjectTemplateBuilder( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 150 } |
149 | 151 |
150 std::string tab_timing_json; | 152 std::string tab_timing_json; |
151 ConvertLoadTimeToJSON( | 153 ConvertLoadTimeToJSON( |
152 observer->load_start_time(), observer->load_stop_time(), | 154 observer->load_start_time(), observer->load_stop_time(), |
153 &tab_timing_json); | 155 &tab_timing_json); |
154 return tab_timing_json; | 156 return tab_timing_json; |
155 } | 157 } |
156 | 158 |
157 } // namespace content | 159 } // namespace content |
OLD | NEW |