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

Side by Side Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 9368053: Move indexed db files from content/renderer to content/common. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move include from child_thread.h to child_thread.cc Created 8 years, 10 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/indexed_db/indexed_db_dispatcher.h" 5 #include "content/common/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
9 #include "content/common/child_thread.h"
9 #include "content/common/indexed_db/indexed_db_messages.h" 10 #include "content/common/indexed_db/indexed_db_messages.h"
10 #include "content/renderer/indexed_db/renderer_webidbcursor_impl.h" 11 #include "content/common/indexed_db/proxy_webidbcursor_impl.h"
11 #include "content/renderer/indexed_db/renderer_webidbdatabase_impl.h" 12 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h"
12 #include "content/renderer/indexed_db/renderer_webidbindex_impl.h" 13 #include "content/common/indexed_db/proxy_webidbindex_impl.h"
13 #include "content/renderer/indexed_db/renderer_webidbobjectstore_impl.h" 14 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
14 #include "content/renderer/indexed_db/renderer_webidbtransaction_impl.h" 15 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
15 #include "content/renderer/render_thread_impl.h"
16 #include "content/renderer/render_view_impl.h"
17 #include "ipc/ipc_channel.h" 16 #include "ipc/ipc_channel.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h " 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
22 21
23 using base::ThreadLocalPointer; 22 using base::ThreadLocalPointer;
24 using WebKit::WebDOMStringList; 23 using WebKit::WebDOMStringList;
25 using WebKit::WebExceptionCode; 24 using WebKit::WebExceptionCode;
26 using WebKit::WebFrame; 25 using WebKit::WebFrame;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 171 }
173 172
174 void IndexedDBDispatcher::RequestIDBFactoryOpen( 173 void IndexedDBDispatcher::RequestIDBFactoryOpen(
175 const string16& name, 174 const string16& name,
176 WebIDBCallbacks* callbacks_ptr, 175 WebIDBCallbacks* callbacks_ptr,
177 const string16& origin, 176 const string16& origin,
178 WebFrame* web_frame) { 177 WebFrame* web_frame) {
179 ResetCursorPrefetchCaches(); 178 ResetCursorPrefetchCaches();
180 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 179 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
181 180
182 if (!web_frame) 181 if (!CurrentWorkerId() &&
183 return; // We must be shutting down. 182 !ChildThread::current()->IsWebFrameValid(web_frame))
184 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_frame->view()); 183 return;
185 if (!render_view)
186 return; // We must be shutting down.
187 184
188 IndexedDBHostMsg_FactoryOpen_Params params; 185 IndexedDBHostMsg_FactoryOpen_Params params;
189 params.thread_id = CurrentWorkerId(); 186 params.thread_id = CurrentWorkerId();
190 params.response_id = pending_callbacks_.Add(callbacks.release()); 187 params.response_id = pending_callbacks_.Add(callbacks.release());
191 params.origin = origin; 188 params.origin = origin;
192 params.name = name; 189 params.name = name;
193 Send(new IndexedDBHostMsg_FactoryOpen(params)); 190 Send(new IndexedDBHostMsg_FactoryOpen(params));
194 } 191 }
195 192
196 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames( 193 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames(
197 WebIDBCallbacks* callbacks_ptr, 194 WebIDBCallbacks* callbacks_ptr,
198 const string16& origin, 195 const string16& origin,
199 WebFrame* web_frame) { 196 WebFrame* web_frame) {
200 ResetCursorPrefetchCaches(); 197 ResetCursorPrefetchCaches();
201 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 198 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
202 199
203 if (!web_frame) 200 if (!CurrentWorkerId() &&
204 return; // We must be shutting down. 201 !ChildThread::current()->IsWebFrameValid(web_frame))
205 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_frame->view()); 202 return;
206 if (!render_view)
207 return; // We must be shutting down.
208 203
209 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params; 204 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params;
210 params.thread_id = CurrentWorkerId(); 205 params.thread_id = CurrentWorkerId();
211 params.response_id = pending_callbacks_.Add(callbacks.release()); 206 params.response_id = pending_callbacks_.Add(callbacks.release());
212 params.origin = origin; 207 params.origin = origin;
213 Send(new IndexedDBHostMsg_FactoryGetDatabaseNames(params)); 208 Send(new IndexedDBHostMsg_FactoryGetDatabaseNames(params));
214 } 209 }
215 210
216 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( 211 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase(
217 const string16& name, 212 const string16& name,
218 WebIDBCallbacks* callbacks_ptr, 213 WebIDBCallbacks* callbacks_ptr,
219 const string16& origin, 214 const string16& origin,
220 WebFrame* web_frame) { 215 WebFrame* web_frame) {
221 ResetCursorPrefetchCaches(); 216 ResetCursorPrefetchCaches();
222 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 217 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
223 218
224 if (!web_frame) 219 if (!CurrentWorkerId() &&
225 return; // We must be shutting down. 220 !ChildThread::current()->IsWebFrameValid(web_frame))
226 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_frame->view()); 221 return;
227 if (!render_view)
228 return; // We must be shutting down.
229 222
230 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; 223 IndexedDBHostMsg_FactoryDeleteDatabase_Params params;
231 params.thread_id = CurrentWorkerId(); 224 params.thread_id = CurrentWorkerId();
232 params.response_id = pending_callbacks_.Add(callbacks.release()); 225 params.response_id = pending_callbacks_.Add(callbacks.release());
233 params.origin = origin; 226 params.origin = origin;
234 params.name = name; 227 params.name = name;
235 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params)); 228 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params));
236 } 229 }
237 230
238 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) { 231 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 672 }
680 673
681 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 674 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
682 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 675 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
683 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 676 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
684 if (i->first == exception_cursor_id) 677 if (i->first == exception_cursor_id)
685 continue; 678 continue;
686 i->second->ResetPrefetchCache(); 679 i->second->ResetPrefetchCache();
687 } 680 }
688 } 681 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698