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

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

Issue 2843673002: [Extensions Bindings] Use gin::Arguments::GetAll() (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 | « no previous file | extensions/renderer/chrome_setting.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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 const APISignature* signature, 491 const APISignature* signature,
492 gin::Arguments* arguments) { 492 gin::Arguments* arguments) {
493 std::string error; 493 std::string error;
494 v8::Isolate* isolate = arguments->isolate(); 494 v8::Isolate* isolate = arguments->isolate();
495 v8::HandleScope handle_scope(isolate); 495 v8::HandleScope handle_scope(isolate);
496 496
497 // Since this is called synchronously from the JS entry point, 497 // Since this is called synchronously from the JS entry point,
498 // GetCurrentContext() should always be correct. 498 // GetCurrentContext() should always be correct.
499 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 499 v8::Local<v8::Context> context = isolate->GetCurrentContext();
500 500
501 std::vector<v8::Local<v8::Value>> argument_list; 501 std::vector<v8::Local<v8::Value>> argument_list = arguments->GetAll();
502 if (arguments->Length() > 0) {
503 // Just copying handles should never fail.
504 CHECK(arguments->GetRemaining(&argument_list));
505 }
506 502
507 bool invalid_invocation = false; 503 bool invalid_invocation = false;
508 v8::Local<v8::Function> custom_callback; 504 v8::Local<v8::Function> custom_callback;
509 bool updated_args = false; 505 bool updated_args = false;
510 { 506 {
511 v8::TryCatch try_catch(isolate); 507 v8::TryCatch try_catch(isolate);
512 APIBindingHooks::RequestResult hooks_result = binding_hooks_->RunHooks( 508 APIBindingHooks::RequestResult hooks_result = binding_hooks_->RunHooks(
513 name, context, signature, &argument_list, *type_refs_); 509 name, context, signature, &argument_list, *type_refs_);
514 510
515 switch (hooks_result.code) { 511 switch (hooks_result.code) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 arguments->ThrowTypeError("Invalid invocation"); 571 arguments->ThrowTypeError("Invalid invocation");
576 return; 572 return;
577 } 573 }
578 574
579 request_handler_->StartRequest(context, name, std::move(converted_arguments), 575 request_handler_->StartRequest(context, name, std::move(converted_arguments),
580 callback, custom_callback, 576 callback, custom_callback,
581 binding::RequestThread::UI); 577 binding::RequestThread::UI);
582 } 578 }
583 579
584 } // namespace extensions 580 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/chrome_setting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698