Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: content/renderer/stats_collection_controller.cc

Issue 113893005: [gin] Introduce Wrappable::GetObjectTemplate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/stats_collection_controller.h ('k') | gin/function_template.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/stats_collection_controller.cc
diff --git a/content/renderer/stats_collection_controller.cc b/content/renderer/stats_collection_controller.cc
index af86c9ea0ef1db4adfce35a7bca02ca8251cf899..0f5230e72d1391cc4f254d5b68cb424d30618b40 100644
--- a/content/renderer/stats_collection_controller.cc
+++ b/content/renderer/stats_collection_controller.cc
@@ -12,7 +12,6 @@
#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/WebView.h"
@@ -76,6 +75,17 @@ gin::WrapperInfo StatsCollectionController::kWrapperInfo = {
};
// static
+v8::Local<v8::ObjectTemplate> StatsCollectionController::GetObjectTemplate(
+ v8::Isolate* isolate) {
+ return gin::ObjectTemplateBuilder(isolate)
+ .SetMethod("getHistogram", &StatsCollectionController::GetHistogram)
+ .SetMethod("getBrowserHistogram",
+ &StatsCollectionController::GetBrowserHistogram)
+ .SetMethod("tabLoadTiming", &StatsCollectionController::GetTabLoadTiming)
+ .Build();
+}
+
+// static
void StatsCollectionController::Install(blink::WebFrame* frame) {
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
@@ -85,21 +95,6 @@ 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());
v8::Handle<v8::Object> global = context->Global();
« no previous file with comments | « content/renderer/stats_collection_controller.h ('k') | gin/function_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698