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

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

Issue 2435873004: [Extensions] Remove unused version of ScriptContext::CallFunction() (Closed)
Patch Set: Created 4 years, 2 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/script_context.h ('k') | no next file » | 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/script_context.h" 5 #include "extensions/renderer/script_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 v8::Local<v8::Object> global = v8_context()->Global(); 212 v8::Local<v8::Object> global = v8_context()->Global();
213 if (web_frame_) { 213 if (web_frame_) {
214 web_frame_->requestExecuteV8Function(v8_context(), function, global, argc, 214 web_frame_->requestExecuteV8Function(v8_context(), function, global, argc,
215 argv, nullptr); 215 argv, nullptr);
216 } else { 216 } else {
217 // TODO(devlin): This probably isn't safe. 217 // TODO(devlin): This probably isn't safe.
218 function->Call(global, argc, argv); 218 function->Call(global, argc, argv);
219 } 219 }
220 } 220 }
221 221
222 v8::Local<v8::Value> ScriptContext::CallFunction(
223 const v8::Local<v8::Function>& function) const {
224 DCHECK(thread_checker_.CalledOnValidThread());
225 return CallFunction(function, 0, nullptr);
226 }
227
228 Feature::Availability ScriptContext::GetAvailability( 222 Feature::Availability ScriptContext::GetAvailability(
229 const std::string& api_name) { 223 const std::string& api_name) {
230 DCHECK(thread_checker_.CalledOnValidThread()); 224 DCHECK(thread_checker_.CalledOnValidThread());
231 if (base::StartsWith(api_name, "test", base::CompareCase::SENSITIVE)) { 225 if (base::StartsWith(api_name, "test", base::CompareCase::SENSITIVE)) {
232 bool allowed = base::CommandLine::ForCurrentProcess()-> 226 bool allowed = base::CommandLine::ForCurrentProcess()->
233 HasSwitch(::switches::kTestType); 227 HasSwitch(::switches::kTestType);
234 Feature::AvailabilityResult result = 228 Feature::AvailabilityResult result =
235 allowed ? Feature::IS_AVAILABLE : Feature::MISSING_COMMAND_LINE_SWITCH; 229 allowed ? Feature::IS_AVAILABLE : Feature::MISSING_COMMAND_LINE_SWITCH;
236 return Feature::Availability(result, 230 return Feature::Availability(result,
237 allowed ? "" : "Only allowed in tests"); 231 allowed ? "" : "Only allowed in tests");
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 v8::Local<v8::Value> argv[]) { 512 v8::Local<v8::Value> argv[]) {
519 return context_->CallFunction(function, argc, argv); 513 return context_->CallFunction(function, argc, argv);
520 } 514 }
521 515
522 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { 516 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() {
523 v8::HandleScope handle_scope(context_->isolate()); 517 v8::HandleScope handle_scope(context_->isolate());
524 return gin::PerContextData::From(context_->v8_context())->context_holder(); 518 return gin::PerContextData::From(context_->v8_context())->context_holder();
525 } 519 }
526 520
527 } // namespace extensions 521 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698