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

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: Finish partial comment Created 3 years, 11 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 } else if (context->isWorkerGlobalScope()) { 828 } else if (context->isWorkerGlobalScope()) {
829 if (WorkerOrWorkletScriptController* script = 829 if (WorkerOrWorkletScriptController* script =
830 toWorkerOrWorkletGlobalScope(context)->scriptController()) { 830 toWorkerOrWorkletGlobalScope(context)->scriptController()) {
831 if (script->getScriptState()->contextIsValid()) 831 if (script->getScriptState()->contextIsValid())
832 return script->getScriptState()->context(); 832 return script->getScriptState()->context();
833 } 833 }
834 } 834 }
835 return v8::Local<v8::Context>(); 835 return v8::Local<v8::Context>();
836 } 836 }
837 837
838 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) { 838 v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) {
839 if (!frame) 839 if (!frame)
840 return v8::Local<v8::Context>(); 840 return v8::Local<v8::Context>();
841 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); 841 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world);
842 if (context.IsEmpty()) 842 if (context.IsEmpty())
843 return v8::Local<v8::Context>(); 843 return v8::Local<v8::Context>();
844 ScriptState* scriptState = ScriptState::from(context); 844 ScriptState* scriptState = ScriptState::from(context);
845 if (scriptState->contextIsValid()) { 845 if (scriptState->contextIsValid()) {
846 ASSERT(toFrameIfNotDetached(context) == frame); 846 ASSERT(toFrameIfNotDetached(context) == frame);
847 return scriptState->context(); 847 return scriptState->context();
848 } 848 }
849 return v8::Local<v8::Context>(); 849 return v8::Local<v8::Context>();
850 } 850 }
851 851
852 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, 852 v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame,
853 DOMWrapperWorld& world) { 853 DOMWrapperWorld& world) {
854 ASSERT(frame); 854 ASSERT(frame);
855 return frame->windowProxy(world)->contextIfInitialized(); 855 return frame->script().windowProxy(world)->contextIfInitialized();
dcheng 2017/01/18 23:43:17 For now, necessary to get to the WindowProxy as a
856 } 856 }
857 857
858 void crashIfIsolateIsDead(v8::Isolate* isolate) { 858 void crashIfIsolateIsDead(v8::Isolate* isolate) {
859 if (isolate->IsDead()) { 859 if (isolate->IsDead()) {
860 // FIXME: We temporarily deal with V8 internal error situations 860 // FIXME: We temporarily deal with V8 internal error situations
861 // such as out-of-memory by crashing the renderer. 861 // such as out-of-memory by crashing the renderer.
862 CRASH(); 862 CRASH();
863 } 863 }
864 } 864 }
865 865
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), 1013 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)),
1014 parsed, tryCatch)) { 1014 parsed, tryCatch)) {
1015 if (tryCatch.HasCaught()) 1015 if (tryCatch.HasCaught())
1016 exceptionState.rethrowV8Exception(tryCatch.Exception()); 1016 exceptionState.rethrowV8Exception(tryCatch.Exception());
1017 } 1017 }
1018 1018
1019 return parsed; 1019 return parsed;
1020 } 1020 }
1021 1021
1022 } // namespace blink 1022 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698