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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2626183003: Switch RemoteWindowProxy to use v8::Context::NewRemoteContext. (Closed)
Patch Set: . Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } else if (context->isWorkerGlobalScope()) { 824 } else if (context->isWorkerGlobalScope()) {
825 if (WorkerOrWorkletScriptController* script = 825 if (WorkerOrWorkletScriptController* script =
826 toWorkerOrWorkletGlobalScope(context)->scriptController()) { 826 toWorkerOrWorkletGlobalScope(context)->scriptController()) {
827 if (script->getScriptState()->contextIsValid()) 827 if (script->getScriptState()->contextIsValid())
828 return script->getScriptState()->context(); 828 return script->getScriptState()->context();
829 } 829 }
830 } 830 }
831 return v8::Local<v8::Context>(); 831 return v8::Local<v8::Context>();
832 } 832 }
833 833
834 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) { 834 v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) {
835 if (!frame) 835 if (!frame)
836 return v8::Local<v8::Context>(); 836 return v8::Local<v8::Context>();
837 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); 837 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world);
838 if (context.IsEmpty()) 838 if (context.IsEmpty())
839 return v8::Local<v8::Context>(); 839 return v8::Local<v8::Context>();
840 ScriptState* scriptState = ScriptState::from(context); 840 ScriptState* scriptState = ScriptState::from(context);
841 if (scriptState->contextIsValid()) { 841 if (scriptState->contextIsValid()) {
842 ASSERT(toFrameIfNotDetached(context) == frame); 842 ASSERT(toFrameIfNotDetached(context) == frame);
843 return scriptState->context(); 843 return scriptState->context();
844 } 844 }
845 return v8::Local<v8::Context>(); 845 return v8::Local<v8::Context>();
846 } 846 }
847 847
848 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, 848 v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame,
849 DOMWrapperWorld& world) { 849 DOMWrapperWorld& world) {
850 ASSERT(frame); 850 ASSERT(frame);
851 return frame->windowProxy(world)->contextIfInitialized(); 851 return frame->script().windowProxy(world)->contextIfInitialized();
852 } 852 }
853 853
854 void crashIfIsolateIsDead(v8::Isolate* isolate) { 854 void crashIfIsolateIsDead(v8::Isolate* isolate) {
855 if (isolate->IsDead()) { 855 if (isolate->IsDead()) {
856 // FIXME: We temporarily deal with V8 internal error situations 856 // FIXME: We temporarily deal with V8 internal error situations
857 // such as out-of-memory by crashing the renderer. 857 // such as out-of-memory by crashing the renderer.
858 CRASH(); 858 CRASH();
859 } 859 }
860 } 860 }
861 861
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), 1009 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)),
1010 parsed, tryCatch)) { 1010 parsed, tryCatch)) {
1011 if (tryCatch.HasCaught()) 1011 if (tryCatch.HasCaught())
1012 exceptionState.rethrowV8Exception(tryCatch.Exception()); 1012 exceptionState.rethrowV8Exception(tryCatch.Exception());
1013 } 1013 }
1014 1014
1015 return parsed; 1015 return parsed;
1016 } 1016 }
1017 1017
1018 } // namespace blink 1018 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698