OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |