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

Side by Side Diff: Source/web/WorkerFileSystemClient.cpp

Issue 50773002: Introduce WebWorkerPermissionClientProxy to deprecate WorkerAllowMainThreadBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated comments, minor code fix Created 7 years, 1 month 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
« no previous file with comments | « Source/web/WorkerAllowMainThreadBridgeBase.h ('k') | Source/web/WorkerPermissionClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "WorkerFileSystemClient.h" 32 #include "WorkerFileSystemClient.h"
33 33
34 #include "WebWorkerBase.h" 34 #include "WebWorkerBase.h"
35 #include "WorkerAllowMainThreadBridgeBase.h" 35 #include "WorkerAllowMainThreadBridgeBase.h"
36 #include "WorkerPermissionClient.h"
36 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
37 #include "core/workers/WorkerGlobalScope.h" 38 #include "core/workers/WorkerGlobalScope.h"
38 #include "core/workers/WorkerThread.h" 39 #include "core/workers/WorkerThread.h"
39 #include "platform/AsyncFileSystemCallbacks.h" 40 #include "platform/AsyncFileSystemCallbacks.h"
40 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
41 #include "public/platform/WebFileError.h" 42 #include "public/platform/WebFileError.h"
42 #include "public/platform/WebFileSystem.h" 43 #include "public/platform/WebFileSystem.h"
43 #include "public/platform/WebFileSystemType.h" 44 #include "public/platform/WebFileSystemType.h"
44 #include "wtf/MainThread.h" 45 #include "wtf/MainThread.h"
45 #include "wtf/Threading.h" 46 #include "wtf/Threading.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return adoptPtr(static_cast<FileSystemClient*>(new WorkerFileSystemClient()) ); 82 return adoptPtr(static_cast<FileSystemClient*>(new WorkerFileSystemClient()) );
82 } 83 }
83 84
84 WorkerFileSystemClient::~WorkerFileSystemClient() 85 WorkerFileSystemClient::~WorkerFileSystemClient()
85 { 86 {
86 } 87 }
87 88
88 bool WorkerFileSystemClient::allowFileSystem(ExecutionContext* context) 89 bool WorkerFileSystemClient::allowFileSystem(ExecutionContext* context)
89 { 90 {
90 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); 91 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
92 WorkerPermissionClient* permissionClient = WorkerPermissionClient::from(work erGlobalScope);
93 if (permissionClient->proxy())
94 return permissionClient->allowFileSystem();
95
96 // FIXME: Deprecate this bridge code when PermissionClientProxy is
97 // implemented by the embedder.
91 WebCore::WorkerThread* workerThread = workerGlobalScope->thread(); 98 WebCore::WorkerThread* workerThread = workerGlobalScope->thread();
92 WorkerRunLoop& runLoop = workerThread->runLoop(); 99 WorkerRunLoop& runLoop = workerThread->runLoop();
93 WebCore::WorkerLoaderProxy* workerLoaderProxy = &workerThread->workerLoaderP roxy(); 100 WebCore::WorkerLoaderProxy* workerLoaderProxy = &workerThread->workerLoaderP roxy();
94 101
95 String mode = "allowFileSystemMode"; 102 String mode = "allowFileSystemMode";
96 mode.append(String::number(runLoop.createUniqueId())); 103 mode.append(String::number(runLoop.createUniqueId()));
97 104
98 RefPtr<AllowFileSystemMainThreadBridge> bridge = AllowFileSystemMainThreadBr idge::create(workerGlobalScope, workerLoaderProxy->toWebWorkerBase(), mode); 105 RefPtr<AllowFileSystemMainThreadBridge> bridge = AllowFileSystemMainThreadBr idge::create(workerGlobalScope, workerLoaderProxy->toWebWorkerBase(), mode);
99 106
100 // Either the bridge returns, or the queue gets terminated. 107 // Either the bridge returns, or the queue gets terminated.
101 // FIXME: This synchoronous execution should be replaced with better model. 108 // FIXME: This synchoronous execution should be replaced with better model.
102 if (runLoop.runInMode(workerGlobalScope, mode) == MessageQueueTerminated) { 109 if (runLoop.runInMode(workerGlobalScope, mode) == MessageQueueTerminated) {
103 bridge->cancel(); 110 bridge->cancel();
104 return false; 111 return false;
105 } 112 }
106 113
107 return bridge->result(); 114 return bridge->result();
108 } 115 }
109 116
110 WorkerFileSystemClient::WorkerFileSystemClient() 117 WorkerFileSystemClient::WorkerFileSystemClient()
111 { 118 {
112 } 119 }
113 120
114 } // namespace WebKit 121 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WorkerAllowMainThreadBridgeBase.h ('k') | Source/web/WorkerPermissionClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698