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

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

Issue 1926353002: Revert of [Extensions] More bindings improvements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 v8::Context::Scope context_scope(context); 97 v8::Context::Scope context_scope(context);
98 98
99 const base::DictionaryValue* schema = 99 const base::DictionaryValue* schema =
100 ExtensionAPI::GetSharedInstance()->GetSchema(api); 100 ExtensionAPI::GetSharedInstance()->GetSchema(api);
101 CHECK(schema) << api; 101 CHECK(schema) << api;
102 scoped_ptr<V8ValueConverter> v8_value_converter(V8ValueConverter::create()); 102 scoped_ptr<V8ValueConverter> v8_value_converter(V8ValueConverter::create());
103 v8::Local<v8::Value> value = v8_value_converter->ToV8Value(schema, context); 103 v8::Local<v8::Value> value = v8_value_converter->ToV8Value(schema, context);
104 CHECK(!value.IsEmpty()); 104 CHECK(!value.IsEmpty());
105 105
106 v8::Local<v8::Object> v8_schema(v8::Local<v8::Object>::Cast(value)); 106 v8::Local<v8::Object> v8_schema(v8::Local<v8::Object>::Cast(value));
107 v8_schema->SetIntegrityLevel(context, v8::IntegrityLevel::kFrozen);
108 schema_cache_->Set(api, v8_schema); 107 schema_cache_->Set(api, v8_schema);
109 108
110 return handle_scope.Escape(v8_schema); 109 return handle_scope.Escape(v8_schema);
111 } 110 }
112 111
113 v8::Local<v8::Context> V8SchemaRegistry::GetOrCreateContext( 112 v8::Local<v8::Context> V8SchemaRegistry::GetOrCreateContext(
114 v8::Isolate* isolate) { 113 v8::Isolate* isolate) {
115 // It's ok to create local handles in this function, since this is only called 114 // It's ok to create local handles in this function, since this is only called
116 // when we have a HandleScope. 115 // when we have a HandleScope.
117 if (!context_holder_) { 116 if (!context_holder_) {
118 context_holder_.reset(new gin::ContextHolder(isolate)); 117 context_holder_.reset(new gin::ContextHolder(isolate));
119 context_holder_->SetContext(v8::Context::New(isolate)); 118 context_holder_->SetContext(v8::Context::New(isolate));
120 schema_cache_.reset(new SchemaCache(isolate)); 119 schema_cache_.reset(new SchemaCache(isolate));
121 return context_holder_->context(); 120 return context_holder_->context();
122 } 121 }
123 return context_holder_->context(); 122 return context_holder_->context();
124 } 123 }
125 124
126 } // namespace extensions 125 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698