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

Side by Side Diff: extensions/renderer/v8_schema_registry.cc

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: being process of relanding - more test assertions Created 5 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/script_context_set_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/v8_schema_registry.h" 5 #include "extensions/renderer/v8_schema_registry.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/public/child/v8_value_converter.h" 9 #include "content/public/child/v8_value_converter.h"
10 #include "extensions/common/extension_api.h" 10 #include "extensions/common/extension_api.h"
(...skipping 11 matching lines...) Expand all
22 SchemaRegistryNativeHandler(V8SchemaRegistry* registry, 22 SchemaRegistryNativeHandler(V8SchemaRegistry* registry,
23 scoped_ptr<ScriptContext> context) 23 scoped_ptr<ScriptContext> context)
24 : ObjectBackedNativeHandler(context.get()), 24 : ObjectBackedNativeHandler(context.get()),
25 context_(context.Pass()), 25 context_(context.Pass()),
26 registry_(registry) { 26 registry_(registry) {
27 RouteFunction("GetSchema", 27 RouteFunction("GetSchema",
28 base::Bind(&SchemaRegistryNativeHandler::GetSchema, 28 base::Bind(&SchemaRegistryNativeHandler::GetSchema,
29 base::Unretained(this))); 29 base::Unretained(this)));
30 } 30 }
31 31
32 ~SchemaRegistryNativeHandler() override { context_->Invalidate(); }
33
32 private: 34 private:
33 void GetSchema(const v8::FunctionCallbackInfo<v8::Value>& args) { 35 void GetSchema(const v8::FunctionCallbackInfo<v8::Value>& args) {
34 args.GetReturnValue().Set( 36 args.GetReturnValue().Set(
35 registry_->GetSchema(*v8::String::Utf8Value(args[0]))); 37 registry_->GetSchema(*v8::String::Utf8Value(args[0])));
36 } 38 }
37 39
38 scoped_ptr<ScriptContext> context_; 40 scoped_ptr<ScriptContext> context_;
39 V8SchemaRegistry* registry_; 41 V8SchemaRegistry* registry_;
40 }; 42 };
41 43
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (!context_holder_) { 112 if (!context_holder_) {
111 context_holder_.reset(new gin::ContextHolder(isolate)); 113 context_holder_.reset(new gin::ContextHolder(isolate));
112 context_holder_->SetContext(v8::Context::New(isolate)); 114 context_holder_->SetContext(v8::Context::New(isolate));
113 schema_cache_.reset(new SchemaCache(isolate)); 115 schema_cache_.reset(new SchemaCache(isolate));
114 return context_holder_->context(); 116 return context_holder_->context();
115 } 117 }
116 return context_holder_->context(); 118 return context_holder_->context();
117 } 119 }
118 120
119 } // namespace extensions 121 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context_set_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698