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

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

Issue 1094393003: Revert of update chrome to handle temporary WEB_FRAME_USES_V8_LOCAL condition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/guest_view/mime_handler_view/mime_handler_view_container.cc ('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/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 v8::Handle<v8::Value> argv[]) const { 181 v8::Handle<v8::Value> argv[]) const {
182 v8::EscapableHandleScope handle_scope(isolate()); 182 v8::EscapableHandleScope handle_scope(isolate());
183 v8::Context::Scope scope(v8_context()); 183 v8::Context::Scope scope(v8_context());
184 184
185 blink::WebScopedMicrotaskSuppression suppression; 185 blink::WebScopedMicrotaskSuppression suppression;
186 if (!is_valid_) { 186 if (!is_valid_) {
187 return handle_scope.Escape( 187 return handle_scope.Escape(
188 v8::Local<v8::Primitive>(v8::Undefined(isolate()))); 188 v8::Local<v8::Primitive>(v8::Undefined(isolate())));
189 } 189 }
190 190
191 #ifdef WEB_FRAME_USES_V8_LOCAL
192 v8::Local<v8::Value>* call_args =
193 reinterpret_cast<v8::Local<v8::Value>*>(argv);
194 #else
195 v8::Handle<v8::Value>* call_args = argv;
196 #endif
197
198 v8::Handle<v8::Object> global = v8_context()->Global(); 191 v8::Handle<v8::Object> global = v8_context()->Global();
199 if (!web_frame_) 192 if (!web_frame_)
200 return handle_scope.Escape(function->Call(global, argc, argv)); 193 return handle_scope.Escape(function->Call(global, argc, argv));
201 return handle_scope.Escape( 194 return handle_scope.Escape(
202 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled( 195 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled(
203 function, global, argc, call_args))); 196 function, global, argc, argv)));
204 } 197 }
205 198
206 Feature::Availability ScriptContext::GetAvailability( 199 Feature::Availability ScriptContext::GetAvailability(
207 const std::string& api_name) { 200 const std::string& api_name) {
208 // Hack: Hosted apps should have the availability of messaging APIs based on 201 // Hack: Hosted apps should have the availability of messaging APIs based on
209 // the URL of the page (which might have access depending on some extension 202 // the URL of the page (which might have access depending on some extension
210 // with externally_connectable), not whether the app has access to messaging 203 // with externally_connectable), not whether the app has access to messaging
211 // (which it won't). 204 // (which it won't).
212 const Extension* extension = extension_.get(); 205 const Extension* extension = extension_.get();
213 if (extension && extension->is_hosted_app() && 206 if (extension && extension->is_hosted_app() &&
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 v8::Handle<v8::Value> argv[]) { 350 v8::Handle<v8::Value> argv[]) {
358 return context_->CallFunction(function, argc, argv); 351 return context_->CallFunction(function, argc, argv);
359 } 352 }
360 353
361 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { 354 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() {
362 v8::HandleScope handle_scope(context_->isolate()); 355 v8::HandleScope handle_scope(context_->isolate());
363 return gin::PerContextData::From(context_->v8_context())->context_holder(); 356 return gin::PerContextData::From(context_->v8_context())->context_holder();
364 } 357 }
365 358
366 } // namespace extensions 359 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698