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

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

Issue 2842673002: [Extensions Bindings] Remove Isolate arg from APIBinding::CreateInstance (Closed)
Patch Set: Created 3 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/api_binding.h ('k') | extensions/renderer/api_binding_unittest.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/api_binding.h" 5 #include "extensions/renderer/api_binding.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 supports_rules, std::move(rule_actions), std::move(rule_conditions), 282 supports_rules, std::move(rule_actions), std::move(rule_conditions),
283 this)); 283 this));
284 } 284 }
285 } 285 }
286 } 286 }
287 287
288 APIBinding::~APIBinding() {} 288 APIBinding::~APIBinding() {}
289 289
290 v8::Local<v8::Object> APIBinding::CreateInstance( 290 v8::Local<v8::Object> APIBinding::CreateInstance(
291 v8::Local<v8::Context> context, 291 v8::Local<v8::Context> context,
292 v8::Isolate* isolate,
293 const AvailabilityCallback& is_available) { 292 const AvailabilityCallback& is_available) {
294 DCHECK(IsContextValid(context)); 293 DCHECK(IsContextValid(context));
294 v8::Isolate* isolate = context->GetIsolate();
295 if (object_template_.IsEmpty()) 295 if (object_template_.IsEmpty())
296 InitializeTemplate(isolate); 296 InitializeTemplate(isolate);
297 DCHECK(!object_template_.IsEmpty()); 297 DCHECK(!object_template_.IsEmpty());
298 298
299 v8::Local<v8::Object> object = 299 v8::Local<v8::Object> object =
300 object_template_.Get(isolate)->NewInstance(context).ToLocalChecked(); 300 object_template_.Get(isolate)->NewInstance(context).ToLocalChecked();
301 301
302 // The object created from the template includes all methods, but some may 302 // The object created from the template includes all methods, but some may
303 // be unavailable in this context. Iterate over them and delete any that 303 // be unavailable in this context. Iterate over them and delete any that
304 // aren't available. 304 // aren't available.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 arguments->ThrowTypeError("Invalid invocation"); 575 arguments->ThrowTypeError("Invalid invocation");
576 return; 576 return;
577 } 577 }
578 578
579 request_handler_->StartRequest(context, name, std::move(converted_arguments), 579 request_handler_->StartRequest(context, name, std::move(converted_arguments),
580 callback, custom_callback, 580 callback, custom_callback,
581 binding::RequestThread::UI); 581 binding::RequestThread::UI);
582 } 582 }
583 583
584 } // namespace extensions 584 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api_binding.h ('k') | extensions/renderer/api_binding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698