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

Side by Side Diff: Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp

Issue 9939006: Merge 112576 - [Chromium] WorkerFileSystemContextObserver can reference a deleted WorkerFileSystemC… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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) 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 RefPtr<WorkerFileSystemCallbacksBridge> m_bridge; 141 RefPtr<WorkerFileSystemCallbacksBridge> m_bridge;
142 const String m_mode; 142 const String m_mode;
143 }; 143 };
144 144
145 // Observes the worker context. By keeping this separate, it is easier to verify 145 // Observes the worker context. By keeping this separate, it is easier to verify
146 // that it only gets deleted on the worker context thread which is verified by ~ Observer. 146 // that it only gets deleted on the worker context thread which is verified by ~ Observer.
147 class WorkerFileSystemContextObserver : public WebCore::WorkerContext::Observer { 147 class WorkerFileSystemContextObserver : public WebCore::WorkerContext::Observer {
148 public: 148 public:
149 static PassOwnPtr<WorkerFileSystemContextObserver> create(WorkerContext* con text, WorkerFileSystemCallbacksBridge* bridge) 149 static PassOwnPtr<WorkerFileSystemContextObserver> create(WorkerContext* con text, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge)
150 { 150 {
151 return adoptPtr(new WorkerFileSystemContextObserver(context, bridge)); 151 return adoptPtr(new WorkerFileSystemContextObserver(context, bridge));
152 } 152 }
153 153
154 // WorkerContext::Observer method. 154 // WorkerContext::Observer method.
155 virtual void notifyStop() 155 virtual void notifyStop()
156 { 156 {
157 m_bridge->stop(); 157 m_bridge->stop();
158 } 158 }
159 159
160 private: 160 private:
161 WorkerFileSystemContextObserver(WorkerContext* context, WorkerFileSystemCall backsBridge* bridge) 161 WorkerFileSystemContextObserver(WorkerContext* context, PassRefPtr<WorkerFil eSystemCallbacksBridge> bridge)
162 : WebCore::WorkerContext::Observer(context) 162 : WebCore::WorkerContext::Observer(context)
163 , m_bridge(bridge) 163 , m_bridge(bridge)
164 { 164 {
165 } 165 }
166 166
167 // Since WorkerFileSystemCallbacksBridge manages the lifetime of this class, 167 RefPtr<WorkerFileSystemCallbacksBridge> m_bridge;
168 // m_bridge will be valid throughout its lifetime.
169 WorkerFileSystemCallbacksBridge* m_bridge;
170 }; 168 };
171 169
172 void WorkerFileSystemCallbacksBridge::stop() 170 void WorkerFileSystemCallbacksBridge::stop()
173 { 171 {
174 ASSERT(m_workerContext->isContextThread()); 172 ASSERT(m_workerContext->isContextThread());
175 { 173 {
176 MutexLocker locker(m_loaderProxyMutex); 174 MutexLocker locker(m_loaderProxyMutex);
177 m_workerLoaderProxy = 0; 175 m_workerLoaderProxy = 0;
178 } 176 }
179 177
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ASSERT(isMainThread()); 460 ASSERT(isMainThread());
463 461
464 MutexLocker locker(m_loaderProxyMutex); 462 MutexLocker locker(m_loaderProxyMutex);
465 if (m_workerLoaderProxy) 463 if (m_workerLoaderProxy)
466 m_workerLoaderProxy->postTaskForModeToWorkerContext(createCallbackTask(& runTaskOnWorkerThread, this, task), mode); 464 m_workerLoaderProxy->postTaskForModeToWorkerContext(createCallbackTask(& runTaskOnWorkerThread, this, task), mode);
467 } 465 }
468 466
469 } // namespace WebCore 467 } // namespace WebCore
470 468
471 #endif // ENABLE(FILE_SYSTEM) 469 #endif // ENABLE(FILE_SYSTEM)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698