OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // --> MainThreadFileSystemCallbacks::didXxx is called on MainThread | 70 // --> MainThreadFileSystemCallbacks::didXxx is called on MainThread |
71 // --> Bridge::didXxxOnMainThread is called on MainThread | 71 // --> Bridge::didXxxOnMainThread is called on MainThread |
72 // --> Bridge::didXxxOnWorkerThread is called on WorkerThread | 72 // --> Bridge::didXxxOnWorkerThread is called on WorkerThread |
73 // This calls the original callbacks (m_callbacksOnWorkerThread). | 73 // This calls the original callbacks (m_callbacksOnWorkerThread). |
74 class WorkerFileSystemCallbacksBridge : public ThreadSafeRefCounted<WorkerFileSy
stemCallbacksBridge> { | 74 class WorkerFileSystemCallbacksBridge : public ThreadSafeRefCounted<WorkerFileSy
stemCallbacksBridge> { |
75 public: | 75 public: |
76 ~WorkerFileSystemCallbacksBridge(); | 76 ~WorkerFileSystemCallbacksBridge(); |
77 | 77 |
78 void stop(); | 78 void stop(); |
79 | 79 |
80 static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebCore::WorkerLoa
derProxy* workerLoaderProxy, WebCore::ScriptExecutionContext* workerContext, Web
FileSystemCallbacksImpl* callbacks) | 80 static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebCore::WorkerLoa
derProxy* workerLoaderProxy, WebCore::ScriptExecutionContext* workerGlobalScope,
WebFileSystemCallbacksImpl* callbacks) |
81 { | 81 { |
82 return adoptRef(new WorkerFileSystemCallbacksBridge(workerLoaderProxy, w
orkerContext, callbacks)); | 82 return adoptRef(new WorkerFileSystemCallbacksBridge(workerLoaderProxy, w
orkerGlobalScope, callbacks)); |
83 } | 83 } |
84 | 84 |
85 // Methods that create an instance and post an initial request task to the m
ain thread. They must be called on the worker thread. | 85 // Methods that create an instance and post an initial request task to the m
ain thread. They must be called on the worker thread. |
86 void postOpenFileSystemToMainThread(WebCommonWorkerClient*, WebFileSystemTyp
e, long long size, bool create, const String& mode); | 86 void postOpenFileSystemToMainThread(WebCommonWorkerClient*, WebFileSystemTyp
e, long long size, bool create, const String& mode); |
87 void postMoveToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, cons
t WebCore::KURL& destPath, const String& mode); | 87 void postMoveToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, cons
t WebCore::KURL& destPath, const String& mode); |
88 void postCopyToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, cons
t WebCore::KURL& destPath, const String& mode); | 88 void postCopyToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, cons
t WebCore::KURL& destPath, const String& mode); |
89 void postRemoveToMainThread(WebFileSystem*, const WebCore::KURL& path, const
String& mode); | 89 void postRemoveToMainThread(WebFileSystem*, const WebCore::KURL& path, const
String& mode); |
90 void postRemoveRecursivelyToMainThread(WebFileSystem*, const WebCore::KURL&
path, const String& mode); | 90 void postRemoveRecursivelyToMainThread(WebFileSystem*, const WebCore::KURL&
path, const String& mode); |
91 void postReadMetadataToMainThread(WebFileSystem*, const WebCore::KURL& path,
const String& mode); | 91 void postReadMetadataToMainThread(WebFileSystem*, const WebCore::KURL& path,
const String& mode); |
92 void postCreateFileToMainThread(WebFileSystem*, const WebCore::KURL& path, b
ool exclusive, const String& mode); | 92 void postCreateFileToMainThread(WebFileSystem*, const WebCore::KURL& path, b
ool exclusive, const String& mode); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 static void runTaskOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefP
tr<WorkerFileSystemCallbacksBridge>, PassOwnPtr<WebCore::ScriptExecutionContext:
:Task>); | 135 static void runTaskOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefP
tr<WorkerFileSystemCallbacksBridge>, PassOwnPtr<WebCore::ScriptExecutionContext:
:Task>); |
136 | 136 |
137 void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Ta
sk>); | 137 void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Ta
sk>); |
138 void mayPostTaskToWorker(PassOwnPtr<WebCore::ScriptExecutionContext::Task>,
const String& mode); | 138 void mayPostTaskToWorker(PassOwnPtr<WebCore::ScriptExecutionContext::Task>,
const String& mode); |
139 | 139 |
140 void cleanUpAfterCallback(); | 140 void cleanUpAfterCallback(); |
141 | 141 |
142 Mutex m_loaderProxyMutex; | 142 Mutex m_loaderProxyMutex; |
143 WebCore::WorkerLoaderProxy* m_workerLoaderProxy; | 143 WebCore::WorkerLoaderProxy* m_workerLoaderProxy; |
144 | 144 |
145 WebCore::ScriptExecutionContext* m_workerContext; | 145 WebCore::ScriptExecutionContext* m_workerGlobalScope; |
146 | 146 |
147 // Must be deleted on the WorkerContext thread. | 147 // Must be deleted on the WorkerGlobalScope thread. |
148 WorkerFileSystemContextObserver* m_workerContextObserver; | 148 WorkerFileSystemContextObserver* m_workerGlobalScopeObserver; |
149 | 149 |
150 // This is self-destructed and must be fired on the worker thread. | 150 // This is self-destructed and must be fired on the worker thread. |
151 WebFileSystemCallbacksImpl* m_callbacksOnWorkerThread; | 151 WebFileSystemCallbacksImpl* m_callbacksOnWorkerThread; |
152 }; | 152 }; |
153 | 153 |
154 } // namespace WebCore | 154 } // namespace WebCore |
155 | 155 |
156 #endif // WorkerFileSystemCallbacksBridge_h | 156 #endif // WorkerFileSystemCallbacksBridge_h |
OLD | NEW |