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

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

Issue 209713003: Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr <ErrorEvent>* errorEvent) 204 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr <ErrorEvent>* errorEvent)
205 { 205 {
206 if (isExecutionForbidden()) 206 if (isExecutionForbidden())
207 return; 207 return;
208 208
209 WorkerGlobalScopeExecutionState state; 209 WorkerGlobalScopeExecutionState state;
210 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), &state); 210 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), &state);
211 if (state.hadException) { 211 if (state.hadException) {
212 if (errorEvent) { 212 if (errorEvent) {
213 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so urceURL, NotSharableCrossOrigin) ? 213 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so urceURL, NotSharableCrossOrigin) ?
214 ErrorEvent::createSanitizedError(0) : ErrorEvent::create(state.e rrorMessage, state.sourceURL, state.lineNumber, state.columnNumber, 0); 214 ErrorEvent::createSanitizedError(m_world.get()) : ErrorEvent::cr eate(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber, m_world.get());
215 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate); 215 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate);
216 } else { 216 } else {
217 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR L, NotSharableCrossOrigin)); 217 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR L, NotSharableCrossOrigin));
218 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state. sourceURL, state.lineNumber, state.columnNumber, 0); 218 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state. sourceURL, state.lineNumber, state.columnNumber, m_world.get());
219 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross Origin); 219 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross Origin);
220 } 220 }
221 } 221 }
222 } 222 }
223 223
224 void WorkerScriptController::scheduleExecutionTermination() 224 void WorkerScriptController::scheduleExecutionTermination()
225 { 225 {
226 // The mutex provides a memory barrier to ensure that once 226 // The mutex provides a memory barrier to ensure that once
227 // termination is scheduled, isExecutionTerminating will 227 // termination is scheduled, isExecutionTerminating will
228 // accurately reflect that state when called from another thread. 228 // accurately reflect that state when called from another thread.
(...skipping 28 matching lines...) Expand all
257 m_disableEvalPending = errorMessage; 257 m_disableEvalPending = errorMessage;
258 } 258 }
259 259
260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<Error Event> errorEvent) 260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<Error Event> 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
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.h ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698