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

Side by Side Diff: Source/bindings/v8/WorkerScriptController.cpp

Issue 306853002: Replace Context::Scope with ScriptState::Scope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 if (isContextInitialized()) 120 if (isContextInitialized())
121 return true; 121 return true;
122 122
123 v8::Handle<v8::Context> context = v8::Context::New(m_isolate); 123 v8::Handle<v8::Context> context = v8::Context::New(m_isolate);
124 if (context.IsEmpty()) 124 if (context.IsEmpty())
125 return false; 125 return false;
126 126
127 m_scriptState = ScriptState::create(context, m_world); 127 m_scriptState = ScriptState::create(context, m_world);
128 128
129 v8::Context::Scope scope(context); 129 ScriptState::Scope scope(m_scriptState.get());
130 130
131 // Set DebugId for the new context. 131 // Set DebugId for the new context.
132 context->SetEmbedderData(0, v8AtomicString(m_isolate, "worker")); 132 context->SetEmbedderData(0, v8AtomicString(m_isolate, "worker"));
133 133
134 // Create a new JS object and use it as the prototype for the shadow global object. 134 // Create a new JS object and use it as the prototype for the shadow global object.
135 const WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::wrapperT ypeInfo; 135 const WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::wrapperT ypeInfo;
136 if (m_workerGlobalScope.isServiceWorkerGlobalScope()) 136 if (m_workerGlobalScope.isServiceWorkerGlobalScope())
137 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; 137 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo;
138 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) 138 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope())
139 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; 139 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 m_disableEvalPending = errorMessage; 257 m_disableEvalPending = errorMessage;
258 } 258 }
259 259
260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent) 260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent)
261 { 261 {
262 m_errorEventFromImportedScript = errorEvent; 262 m_errorEventFromImportedScript = errorEvent;
263 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp ortedScript->message(), m_isolate), m_isolate); 263 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp ortedScript->message(), m_isolate), m_isolate);
264 } 264 }
265 265
266 } // namespace WebCore 266 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698