OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/html_viewer/stats_collection_controller.h" | 5 #include "components/html_viewer/stats_collection_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (context.IsEmpty()) | 80 if (context.IsEmpty()) |
81 return nullptr; | 81 return nullptr; |
82 | 82 |
83 v8::Context::Scope context_scope(context); | 83 v8::Context::Scope context_scope(context); |
84 | 84 |
85 scoped_ptr<mojo::Connection> connection = shell->Connect("mojo:tracing"); | 85 scoped_ptr<mojo::Connection> connection = shell->Connect("mojo:tracing"); |
86 if (!connection) | 86 if (!connection) |
87 return nullptr; | 87 return nullptr; |
88 tracing::StartupPerformanceDataCollectorPtr collector_for_controller; | 88 tracing::StartupPerformanceDataCollectorPtr collector_for_controller; |
89 tracing::StartupPerformanceDataCollectorPtr collector_for_caller; | 89 tracing::StartupPerformanceDataCollectorPtr collector_for_caller; |
90 connection->ConnectToService(&collector_for_controller); | 90 connection->GetInterface(&collector_for_controller); |
91 connection->ConnectToService(&collector_for_caller); | 91 connection->GetInterface(&collector_for_caller); |
92 | 92 |
93 gin::Handle<StatsCollectionController> controller = gin::CreateHandle( | 93 gin::Handle<StatsCollectionController> controller = gin::CreateHandle( |
94 isolate, | 94 isolate, |
95 new StatsCollectionController(std::move(collector_for_controller))); | 95 new StatsCollectionController(std::move(collector_for_controller))); |
96 DCHECK(!controller.IsEmpty()); | 96 DCHECK(!controller.IsEmpty()); |
97 v8::Local<v8::Object> global = context->Global(); | 97 v8::Local<v8::Object> global = context->Global(); |
98 global->Set(gin::StringToV8(isolate, "statsCollectionController"), | 98 global->Set(gin::StringToV8(isolate, "statsCollectionController"), |
99 controller.ToV8()); | 99 controller.ToV8()); |
100 return collector_for_caller; | 100 return collector_for_caller; |
101 } | 101 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 histogram->WriteJSON(&histogram_json); | 152 histogram->WriteJSON(&histogram_json); |
153 return histogram_json; | 153 return histogram_json; |
154 } | 154 } |
155 | 155 |
156 std::string StatsCollectionController::GetBrowserHistogram( | 156 std::string StatsCollectionController::GetBrowserHistogram( |
157 const std::string& histogram_name) { | 157 const std::string& histogram_name) { |
158 return GetHistogram(histogram_name); | 158 return GetHistogram(histogram_name); |
159 } | 159 } |
160 | 160 |
161 } // namespace html_viewer | 161 } // namespace html_viewer |
OLD | NEW |