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

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

Issue 2949143002: [Extensions Bindings] Support ArrayBufferView in idl files (Closed)
Patch Set: extend comment Created 3 years, 6 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/bindings/argument_spec.cc ('k') | tools/json_schema_compiler/idl_schema.py » ('j') | 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void GetSchema(const v8::FunctionCallbackInfo<v8::Value>& args) { 60 void GetSchema(const v8::FunctionCallbackInfo<v8::Value>& args) {
61 args.GetReturnValue().Set( 61 args.GetReturnValue().Set(
62 registry_->GetSchema(*v8::String::Utf8Value(args[0]))); 62 registry_->GetSchema(*v8::String::Utf8Value(args[0])));
63 } 63 }
64 64
65 void GetObjectType(const v8::FunctionCallbackInfo<v8::Value>& args) { 65 void GetObjectType(const v8::FunctionCallbackInfo<v8::Value>& args) {
66 CHECK(args.Length() == 1 && args[0]->IsObject()); 66 CHECK(args.Length() == 1 && args[0]->IsObject());
67 std::string type; 67 std::string type;
68 if (args[0]->IsArray()) 68 if (args[0]->IsArray())
69 type = "array"; 69 type = "array";
70 else if (args[0]->IsArrayBuffer()) 70 else if (args[0]->IsArrayBuffer() || args[0]->IsArrayBufferView())
71 type = "binary"; 71 type = "binary";
72 else 72 else
73 type = "object"; 73 type = "object";
74 args.GetReturnValue().Set( 74 args.GetReturnValue().Set(
75 v8_helpers::ToV8StringUnsafe(context()->isolate(), type.c_str())); 75 v8_helpers::ToV8StringUnsafe(context()->isolate(), type.c_str()));
76 } 76 }
77 77
78 std::unique_ptr<ScriptContext> context_; 78 std::unique_ptr<ScriptContext> context_;
79 V8SchemaRegistry* registry_; 79 V8SchemaRegistry* registry_;
80 }; 80 };
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (!context_holder_) { 161 if (!context_holder_) {
162 context_holder_.reset(new gin::ContextHolder(isolate)); 162 context_holder_.reset(new gin::ContextHolder(isolate));
163 context_holder_->SetContext(v8::Context::New(isolate)); 163 context_holder_->SetContext(v8::Context::New(isolate));
164 schema_cache_.reset(new SchemaCache(isolate)); 164 schema_cache_.reset(new SchemaCache(isolate));
165 return context_holder_->context(); 165 return context_holder_->context();
166 } 166 }
167 return context_holder_->context(); 167 return context_holder_->context();
168 } 168 }
169 169
170 } // namespace extensions 170 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/bindings/argument_spec.cc ('k') | tools/json_schema_compiler/idl_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698