| OLD | NEW |
| 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/renderer/v8_value_converter.h" | 9 #include "content/public/renderer/v8_value_converter.h" |
| 10 #include "extensions/common/extension_api.h" | 10 #include "extensions/common/extension_api.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 V8SchemaRegistry::~V8SchemaRegistry() { | 47 V8SchemaRegistry::~V8SchemaRegistry() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 scoped_ptr<NativeHandler> V8SchemaRegistry::AsNativeHandler() { | 50 scoped_ptr<NativeHandler> V8SchemaRegistry::AsNativeHandler() { |
| 51 scoped_ptr<ScriptContext> context( | 51 scoped_ptr<ScriptContext> context( |
| 52 new ScriptContext(GetOrCreateContext(v8::Isolate::GetCurrent()), | 52 new ScriptContext(GetOrCreateContext(v8::Isolate::GetCurrent()), |
| 53 NULL, // no frame | 53 NULL, // no frame |
| 54 NULL, // no extension | 54 NULL, // no extension |
| 55 Feature::UNSPECIFIED_CONTEXT, |
| 56 NULL, // no effective extension |
| 55 Feature::UNSPECIFIED_CONTEXT)); | 57 Feature::UNSPECIFIED_CONTEXT)); |
| 56 return scoped_ptr<NativeHandler>( | 58 return scoped_ptr<NativeHandler>( |
| 57 new SchemaRegistryNativeHandler(this, context.Pass())); | 59 new SchemaRegistryNativeHandler(this, context.Pass())); |
| 58 } | 60 } |
| 59 | 61 |
| 60 v8::Handle<v8::Array> V8SchemaRegistry::GetSchemas( | 62 v8::Handle<v8::Array> V8SchemaRegistry::GetSchemas( |
| 61 const std::vector<std::string>& apis) { | 63 const std::vector<std::string>& apis) { |
| 62 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 64 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 63 v8::EscapableHandleScope handle_scope(isolate); | 65 v8::EscapableHandleScope handle_scope(isolate); |
| 64 v8::Context::Scope context_scope(GetOrCreateContext(isolate)); | 66 v8::Context::Scope context_scope(GetOrCreateContext(isolate)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (!context_holder_) { | 110 if (!context_holder_) { |
| 109 context_holder_.reset(new gin::ContextHolder(isolate)); | 111 context_holder_.reset(new gin::ContextHolder(isolate)); |
| 110 context_holder_->SetContext(v8::Context::New(isolate)); | 112 context_holder_->SetContext(v8::Context::New(isolate)); |
| 111 schema_cache_.reset(new SchemaCache(isolate)); | 113 schema_cache_.reset(new SchemaCache(isolate)); |
| 112 return context_holder_->context(); | 114 return context_holder_->context(); |
| 113 } | 115 } |
| 114 return context_holder_->context(); | 116 return context_holder_->context(); |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace extensions | 119 } // namespace extensions |
| OLD | NEW |