diff options
| author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
| commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
| tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/workers | |
| parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
| download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 | |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/workers')
| -rw-r--r-- | Source/WebCore/workers/WorkerContext.cpp | 24 | ||||
| -rw-r--r-- | Source/WebCore/workers/WorkerContext.h | 19 | ||||
| -rw-r--r-- | Source/WebCore/workers/WorkerContext.idl | 12 | ||||
| -rw-r--r-- | Source/WebCore/workers/WorkerScriptLoader.h | 2 | ||||
| -rw-r--r-- | Source/WebCore/workers/WorkerThread.cpp | 4 |
5 files changed, 37 insertions, 24 deletions
diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index 3b14e59..c2fce5c 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -51,6 +51,7 @@ #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "SecurityOrigin.h" +#include "WorkerInspectorController.h" #include "WorkerLocation.h" #include "WorkerNavigator.h" #include "WorkerObjectProxy.h" @@ -106,6 +107,9 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr , m_userAgent(userAgent) , m_script(new WorkerScriptController(this)) , m_thread(thread) +#if ENABLE(INSPECTOR) + , m_workerInspectorController(new WorkerInspectorController(this)) +#endif , m_closing(false) { setSecurityOrigin(SecurityOrigin::create(url)); @@ -167,9 +171,10 @@ void WorkerContext::close() if (m_closing) return; - m_closing = true; // Let current script run to completion but prevent future script evaluations. - m_script->forbidExecution(WorkerScriptController::LetRunningScriptFinish); + // After m_closing is set, all the tasks in the queue continue to be fetched but only + // tasks with isCleanupTask()==true will be executed. + m_closing = true; postTask(CloseWorkerContextTask::create()); } @@ -320,7 +325,7 @@ bool WorkerContext::isContextThread() const return currentThread() == thread()->threadID(); } -bool WorkerContext::isJSExecutionTerminated() const +bool WorkerContext::isJSExecutionForbidden() const { return m_script->isExecutionForbidden(); } @@ -345,7 +350,7 @@ DOMURL* WorkerContext::webkitURL() const #endif #if ENABLE(FILE_SYSTEM) -void WorkerContext::requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +void WorkerContext::webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem()) { DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::SECURITY_ERR)); @@ -353,7 +358,7 @@ void WorkerContext::requestFileSystem(int type, long long size, PassRefPtr<FileS } AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); - if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) { + if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent && fileSystemType != AsyncFileSystem::External) { DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); return; } @@ -361,7 +366,7 @@ void WorkerContext::requestFileSystem(int type, long long size, PassRefPtr<FileS LocalFileSystem::localFileSystem().requestFileSystem(this, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, this), false); } -PassRefPtr<DOMFileSystemSync> WorkerContext::requestFileSystemSync(int type, long long size, ExceptionCode& ec) +PassRefPtr<DOMFileSystemSync> WorkerContext::webkitRequestFileSystemSync(int type, long long size, ExceptionCode& ec) { ec = 0; if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem()) { @@ -370,7 +375,7 @@ PassRefPtr<DOMFileSystemSync> WorkerContext::requestFileSystemSync(int type, lon } AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); - if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) { + if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent && fileSystemType != AsyncFileSystem::External) { ec = FileException::INVALID_MODIFICATION_ERR; return 0; } @@ -380,7 +385,7 @@ PassRefPtr<DOMFileSystemSync> WorkerContext::requestFileSystemSync(int type, lon return helper.getResult(ec); } -void WorkerContext::resolveLocalFileSystemURL(const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +void WorkerContext::webkitResolveLocalFileSystemURL(const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { KURL completedURL = completeURL(url); if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem() || !securityOrigin()->canRequest(completedURL)) { @@ -398,7 +403,7 @@ void WorkerContext::resolveLocalFileSystemURL(const String& url, PassRefPtr<Entr LocalFileSystem::localFileSystem().readFileSystem(this, type, ResolveURICallbacks::create(successCallback, errorCallback, this, filePath)); } -PassRefPtr<EntrySync> WorkerContext::resolveLocalFileSystemSyncURL(const String& url, ExceptionCode& ec) +PassRefPtr<EntrySync> WorkerContext::webkitResolveLocalFileSystemSyncURL(const String& url, ExceptionCode& ec) { ec = 0; KURL completedURL = completeURL(url); @@ -429,6 +434,7 @@ PassRefPtr<EntrySync> WorkerContext::resolveLocalFileSystemSyncURL(const String& COMPILE_ASSERT(static_cast<int>(WorkerContext::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch); COMPILE_ASSERT(static_cast<int>(WorkerContext::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch); +COMPILE_ASSERT(static_cast<int>(WorkerContext::EXTERNAL) == static_cast<int>(AsyncFileSystem::External), enum_mismatch); #endif WorkerContext::Observer::Observer(WorkerContext* context) diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index d2ccb11..8237da1 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -56,6 +56,7 @@ namespace WebCore { class FileSystemCallback; class NotificationCenter; class ScheduledAction; + class WorkerInspectorController; class WorkerLocation; class WorkerNavigator; class WorkerThread; @@ -120,7 +121,7 @@ namespace WebCore { virtual void databaseExceededQuota(const String&); #endif virtual bool isContextThread() const; - virtual bool isJSExecutionTerminated() const; + virtual bool isJSExecutionForbidden() const; #if ENABLE(BLOB) DOMURL* webkitURL() const; @@ -130,13 +131,16 @@ namespace WebCore { enum FileSystemType { TEMPORARY, PERSISTENT, + EXTERNAL, }; - void requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback>); - PassRefPtr<DOMFileSystemSync> requestFileSystemSync(int type, long long size, ExceptionCode&); - void resolveLocalFileSystemURL(const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback>); - PassRefPtr<EntrySync> resolveLocalFileSystemSyncURL(const String& url, ExceptionCode&); + void webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback>); + PassRefPtr<DOMFileSystemSync> webkitRequestFileSystemSync(int type, long long size, ExceptionCode&); + void webkitResolveLocalFileSystemURL(const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback>); + PassRefPtr<EntrySync> webkitResolveLocalFileSystemSyncURL(const String& url, ExceptionCode&); +#endif +#if ENABLE(INSPECTOR) + WorkerInspectorController* workerInspectorController() { return m_workerInspectorController.get(); } #endif - // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in // JSWorkerContextCustom.cpp. WorkerNavigator* optionalNavigator() const { return m_navigator.get(); } @@ -196,6 +200,9 @@ namespace WebCore { #if ENABLE(BLOB) mutable RefPtr<DOMURL> m_domURL; #endif +#if ENABLE(INSPECTOR) + OwnPtr<WorkerInspectorController> m_workerInspectorController; +#endif bool m_closing; EventTargetData m_eventTargetData; diff --git a/Source/WebCore/workers/WorkerContext.idl b/Source/WebCore/workers/WorkerContext.idl index 7b2af6b..e31f5ad 100644 --- a/Source/WebCore/workers/WorkerContext.idl +++ b/Source/WebCore/workers/WorkerContext.idl @@ -98,7 +98,7 @@ module threads { #endif #if defined(ENABLE_BLOB) && ENABLE_BLOB - attribute BlobBuilderConstructor BlobBuilder; + attribute WebKitBlobBuilderConstructor WebKitBlobBuilder; attribute FileReaderConstructor FileReader; attribute FileReaderSyncConstructor FileReaderSync; #endif @@ -108,12 +108,12 @@ module threads { #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM const unsigned short TEMPORARY = 0; const unsigned short PERSISTENT = 1; - [EnabledAtRuntime=FileSystem] void requestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [EnabledAtRuntime=FileSystem] DOMFileSystemSync requestFileSystemSync(in unsigned short type, in long long size) raises (FileException); - [EnabledAtRuntime=FileSystem] void resolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [EnabledAtRuntime=FileSystem] EntrySync resolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); + [EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [EnabledAtRuntime=FileSystem] DOMFileSystemSync webkitRequestFileSystemSync(in unsigned short type, in long long size) raises (FileException); + [EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [EnabledAtRuntime=FileSystem] EntrySync webkitResolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); - attribute [EnabledAtRuntime=FileSystem] FlagsConstructor Flags; + attribute [EnabledAtRuntime=FileSystem] WebKitFlagsConstructor WebKitFlags; attribute [EnabledAtRuntime=FileSystem] FileErrorConstructor FileError; attribute [EnabledAtRuntime=FileSystem] FileExceptionConstructor FileException; #endif diff --git a/Source/WebCore/workers/WorkerScriptLoader.h b/Source/WebCore/workers/WorkerScriptLoader.h index 4f045b5..67f113a 100644 --- a/Source/WebCore/workers/WorkerScriptLoader.h +++ b/Source/WebCore/workers/WorkerScriptLoader.h @@ -58,7 +58,7 @@ namespace WebCore { unsigned long identifier() const { return m_identifier; } virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char* data, int lengthReceived); + virtual void didReceiveData(const char* data, int dataLength); virtual void didFinishLoading(unsigned long identifier, double); virtual void didFail(const ResourceError&); virtual void didFailRedirectCheck(); diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index deafb0b..aef936f 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -127,7 +127,7 @@ void* WorkerThread::workerThread() if (m_runLoop.terminated()) { // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, // forbidExecution() couldn't be called from stop(). - m_workerContext->script()->forbidExecution(WorkerScriptController::TerminateRunningScript); + m_workerContext->script()->forbidExecution(); } } @@ -228,7 +228,7 @@ void WorkerThread::stop() // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever. if (m_workerContext) { - m_workerContext->script()->forbidExecution(WorkerScriptController::TerminateRunningScript); + m_workerContext->script()->scheduleExecutionTermination(); #if ENABLE(DATABASE) DatabaseTracker::tracker().interruptAllDatabasesForContext(m_workerContext.get()); |
