| OLD | NEW |
| 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/common/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 235 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 236 | 236 |
| 237 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | 237 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| 238 Send(new IndexedDBHostMsg_CursorDelete(ipc_cursor_id, CurrentWorkerId(), | 238 Send(new IndexedDBHostMsg_CursorDelete(ipc_cursor_id, CurrentWorkerId(), |
| 239 ipc_callbacks_id)); | 239 ipc_callbacks_id)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void IndexedDBDispatcher::RequestIDBFactoryOpen( | 242 void IndexedDBDispatcher::RequestIDBFactoryOpen( |
| 243 const string16& name, | 243 const string16& name, |
| 244 int64 version, | 244 int64 version, |
| 245 WebIDBCallbacks* callbacks_ptr, | |
| 246 WebIDBDatabaseCallbacks* database_callbacks_ptr, | |
| 247 const string16& origin, | |
| 248 WebFrame* web_frame) { | |
| 249 ResetCursorPrefetchCaches(); | |
| 250 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | |
| 251 scoped_ptr<WebIDBDatabaseCallbacks> | |
| 252 database_callbacks(database_callbacks_ptr); | |
| 253 | |
| 254 IndexedDBHostMsg_FactoryOpen_Params params; | |
| 255 params.ipc_thread_id = CurrentWorkerId(); | |
| 256 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | |
| 257 params.ipc_database_callbacks_id = pending_database_callbacks_.Add( | |
| 258 database_callbacks.release()); | |
| 259 params.origin = origin; | |
| 260 params.name = name; | |
| 261 params.transaction_id = 0; | |
| 262 params.version = version; | |
| 263 Send(new IndexedDBHostMsg_FactoryOpen(params)); | |
| 264 } | |
| 265 | |
| 266 void IndexedDBDispatcher::RequestIDBFactoryOpen( | |
| 267 const string16& name, | |
| 268 int64 version, | |
| 269 int64 transaction_id, | 245 int64 transaction_id, |
| 270 WebIDBCallbacks* callbacks_ptr, | 246 WebIDBCallbacks* callbacks_ptr, |
| 271 WebIDBDatabaseCallbacks* database_callbacks_ptr, | 247 WebIDBDatabaseCallbacks* database_callbacks_ptr, |
| 272 const string16& origin, | 248 const string16& database_identifier) { |
| 273 WebFrame* web_frame) { | |
| 274 ResetCursorPrefetchCaches(); | 249 ResetCursorPrefetchCaches(); |
| 275 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 250 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 276 scoped_ptr<WebIDBDatabaseCallbacks> | 251 scoped_ptr<WebIDBDatabaseCallbacks> |
| 277 database_callbacks(database_callbacks_ptr); | 252 database_callbacks(database_callbacks_ptr); |
| 278 | 253 |
| 279 IndexedDBHostMsg_FactoryOpen_Params params; | 254 IndexedDBHostMsg_FactoryOpen_Params params; |
| 280 params.ipc_thread_id = CurrentWorkerId(); | 255 params.ipc_thread_id = CurrentWorkerId(); |
| 281 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | 256 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| 282 params.ipc_database_callbacks_id = pending_database_callbacks_.Add( | 257 params.ipc_database_callbacks_id = pending_database_callbacks_.Add( |
| 283 database_callbacks.release()); | 258 database_callbacks.release()); |
| 284 params.origin = origin; | 259 params.database_identifier = database_identifier; |
| 285 params.name = name; | 260 params.name = name; |
| 286 params.transaction_id = transaction_id; | 261 params.transaction_id = transaction_id; |
| 287 params.version = version; | 262 params.version = version; |
| 288 Send(new IndexedDBHostMsg_FactoryOpen(params)); | 263 Send(new IndexedDBHostMsg_FactoryOpen(params)); |
| 289 } | 264 } |
| 290 | 265 |
| 291 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames( | 266 void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames( |
| 292 WebIDBCallbacks* callbacks_ptr, | 267 WebIDBCallbacks* callbacks_ptr, |
| 293 const string16& origin, | 268 const string16& database_identifier) { |
| 294 WebFrame* web_frame) { | |
| 295 ResetCursorPrefetchCaches(); | 269 ResetCursorPrefetchCaches(); |
| 296 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 270 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 297 | 271 |
| 298 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params; | 272 IndexedDBHostMsg_FactoryGetDatabaseNames_Params params; |
| 299 params.ipc_thread_id = CurrentWorkerId(); | 273 params.ipc_thread_id = CurrentWorkerId(); |
| 300 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | 274 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| 301 params.origin = origin; | 275 params.database_identifier = database_identifier; |
| 302 Send(new IndexedDBHostMsg_FactoryGetDatabaseNames(params)); | 276 Send(new IndexedDBHostMsg_FactoryGetDatabaseNames(params)); |
| 303 } | 277 } |
| 304 | 278 |
| 305 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( | 279 void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( |
| 306 const string16& name, | 280 const string16& name, |
| 307 WebIDBCallbacks* callbacks_ptr, | 281 WebIDBCallbacks* callbacks_ptr, |
| 308 const string16& origin, | 282 const string16& database_identifier) { |
| 309 WebFrame* web_frame) { | |
| 310 ResetCursorPrefetchCaches(); | 283 ResetCursorPrefetchCaches(); |
| 311 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 284 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 312 | 285 |
| 313 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; | 286 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; |
| 314 params.ipc_thread_id = CurrentWorkerId(); | 287 params.ipc_thread_id = CurrentWorkerId(); |
| 315 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); | 288 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| 316 params.origin = origin; | 289 params.database_identifier = database_identifier; |
| 317 params.name = name; | 290 params.name = name; |
| 318 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params)); | 291 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params)); |
| 319 } | 292 } |
| 320 | 293 |
| 321 void IndexedDBDispatcher::RequestIDBDatabaseClose( | 294 void IndexedDBDispatcher::RequestIDBDatabaseClose( |
| 322 int32 ipc_database_id, | 295 int32 ipc_database_id, |
| 323 int32 ipc_database_callbacks_id) { | 296 int32 ipc_database_callbacks_id) { |
| 324 ResetCursorPrefetchCaches(); | 297 ResetCursorPrefetchCaches(); |
| 325 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id)); | 298 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id)); |
| 326 // There won't be pending database callbacks if the transaction was aborted in | 299 // There won't be pending database callbacks if the transaction was aborted in |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 int32 ipc_exception_cursor_id) { | 726 int32 ipc_exception_cursor_id) { |
| 754 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 727 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
| 755 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 728 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 756 if (i->first == ipc_exception_cursor_id) | 729 if (i->first == ipc_exception_cursor_id) |
| 757 continue; | 730 continue; |
| 758 i->second->ResetPrefetchCache(); | 731 i->second->ResetPrefetchCache(); |
| 759 } | 732 } |
| 760 } | 733 } |
| 761 | 734 |
| 762 } // namespace content | 735 } // namespace content |
| OLD | NEW |