diff options
Diffstat (limited to 'chromium/content/renderer/stats_collection_controller.cc')
-rw-r--r-- | chromium/content/renderer/stats_collection_controller.cc | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/chromium/content/renderer/stats_collection_controller.cc b/chromium/content/renderer/stats_collection_controller.cc index af86c9ea0ef..713407942a7 100644 --- a/chromium/content/renderer/stats_collection_controller.cc +++ b/chromium/content/renderer/stats_collection_controller.cc @@ -12,9 +12,8 @@ #include "content/renderer/render_view_impl.h" #include "gin/handle.h" #include "gin/object_template_builder.h" -#include "gin/per_isolate_data.h" -#include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebKit.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebView.h" namespace content { @@ -22,7 +21,8 @@ namespace content { namespace { bool CurrentRenderViewImpl(RenderViewImpl** out) { - blink::WebFrame* web_frame = blink::WebFrame::frameForCurrentContext(); + blink::WebLocalFrame* web_frame = + blink::WebLocalFrame::frameForCurrentContext(); if (!web_frame) return false; @@ -85,23 +85,10 @@ void StatsCollectionController::Install(blink::WebFrame* frame) { v8::Context::Scope context_scope(context); - gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); - if (data->GetObjectTemplate(&StatsCollectionController::kWrapperInfo) - .IsEmpty()) { - v8::Handle<v8::ObjectTemplate> templ = - gin::ObjectTemplateBuilder(isolate) - .SetMethod("getHistogram", &StatsCollectionController::GetHistogram) - .SetMethod("getBrowserHistogram", - &StatsCollectionController::GetBrowserHistogram) - .SetMethod("tabLoadTiming", - &StatsCollectionController::GetTabLoadTiming) - .Build(); - templ->SetInternalFieldCount(gin::kNumberOfInternalFields); - data->SetObjectTemplate(&StatsCollectionController::kWrapperInfo, templ); - } - gin::Handle<StatsCollectionController> controller = gin::CreateHandle(isolate, new StatsCollectionController()); + if (controller.IsEmpty()) + return; v8::Handle<v8::Object> global = context->Global(); global->Set(gin::StringToV8(isolate, "statsCollectionController"), controller.ToV8()); @@ -111,6 +98,16 @@ StatsCollectionController::StatsCollectionController() {} StatsCollectionController::~StatsCollectionController() {} +gin::ObjectTemplateBuilder StatsCollectionController::GetObjectTemplateBuilder( + v8::Isolate* isolate) { + return gin::Wrappable<StatsCollectionController>::GetObjectTemplateBuilder( + isolate) + .SetMethod("getHistogram", &StatsCollectionController::GetHistogram) + .SetMethod("getBrowserHistogram", + &StatsCollectionController::GetBrowserHistogram) + .SetMethod("tabLoadTiming", &StatsCollectionController::GetTabLoadTiming); +} + std::string StatsCollectionController::GetHistogram( const std::string& histogram_name) { base::HistogramBase* histogram = |