Chromium Code Reviews| Index: content/common_child/indexed_db/indexed_db_dispatcher.cc |
| diff --git a/content/common_child/indexed_db/indexed_db_dispatcher.cc b/content/common_child/indexed_db/indexed_db_dispatcher.cc |
| index a806556e4f6a5b2e727d0c218adf18218dd39af2..f06f19e4a9abf134557db627d5c94f33371e3056 100644 |
| --- a/content/common_child/indexed_db/indexed_db_dispatcher.cc |
| +++ b/content/common_child/indexed_db/indexed_db_dispatcher.cc |
| @@ -77,9 +77,7 @@ IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() { |
| return dispatcher; |
| } |
| -void IndexedDBDispatcher::OnWorkerRunLoopStopped() { |
| - delete this; |
| -} |
| +void IndexedDBDispatcher::OnWorkerRunLoopStopped() { delete this; } |
|
jsbell
2013/06/03 17:52:27
more clang-format...
|
| WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( |
| const IndexedDBDatabaseMetadata& idb_metadata) { |
| @@ -89,8 +87,8 @@ WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( |
| web_metadata.version = idb_metadata.version; |
| web_metadata.intVersion = idb_metadata.int_version; |
| web_metadata.maxObjectStoreId = idb_metadata.max_object_store_id; |
| - web_metadata.objectStores = WebVector<WebIDBMetadata::ObjectStore>( |
| - idb_metadata.object_stores.size()); |
| + web_metadata.objectStores = |
| + WebVector<WebIDBMetadata::ObjectStore>(idb_metadata.object_stores.size()); |
| for (size_t i = 0; i < idb_metadata.object_stores.size(); ++i) { |
| const IndexedDBObjectStoreMetadata& idb_store_metadata = |
| @@ -103,14 +101,13 @@ WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( |
| web_store_metadata.keyPath = idb_store_metadata.keyPath; |
| web_store_metadata.autoIncrement = idb_store_metadata.autoIncrement; |
| web_store_metadata.maxIndexId = idb_store_metadata.max_index_id; |
| - web_store_metadata.indexes = WebVector<WebIDBMetadata::Index>( |
| - idb_store_metadata.indexes.size()); |
| + web_store_metadata.indexes = |
| + WebVector<WebIDBMetadata::Index>(idb_store_metadata.indexes.size()); |
| for (size_t j = 0; j < idb_store_metadata.indexes.size(); ++j) { |
| const IndexedDBIndexMetadata& idb_index_metadata = |
| idb_store_metadata.indexes[j]; |
| - WebIDBMetadata::Index& web_index_metadata = |
| - web_store_metadata.indexes[j]; |
| + WebIDBMetadata::Index& web_index_metadata = web_store_metadata.indexes[j]; |
| web_index_metadata.id = idb_index_metadata.id; |
| web_index_metadata.name = idb_index_metadata.name; |
| @@ -140,12 +137,10 @@ void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| OnSuccessIndexedDBKey) |
| IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, |
| OnSuccessStringList) |
| - IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, |
| - OnSuccessValue) |
| + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, OnSuccessValue) |
| IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValueWithKey, |
| OnSuccessValueWithKey) |
| - IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, |
| - OnSuccessInteger) |
| + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, OnSuccessInteger) |
| IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, |
| OnSuccessUndefined) |
| IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
| @@ -189,8 +184,8 @@ void IndexedDBDispatcher::RequestIDBCursorAdvance( |
| scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - Send(new IndexedDBHostMsg_CursorAdvance(ipc_cursor_id, CurrentWorkerId(), |
| - ipc_callbacks_id, count)); |
| + Send(new IndexedDBHostMsg_CursorAdvance( |
| + ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, count)); |
| } |
| void IndexedDBDispatcher::RequestIDBCursorContinue( |
| @@ -203,9 +198,8 @@ void IndexedDBDispatcher::RequestIDBCursorContinue( |
| scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - Send( |
| - new IndexedDBHostMsg_CursorContinue(ipc_cursor_id, CurrentWorkerId(), |
| - ipc_callbacks_id, key)); |
| + Send(new IndexedDBHostMsg_CursorContinue( |
| + ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, key)); |
| } |
| void IndexedDBDispatcher::RequestIDBCursorPrefetch( |
| @@ -215,26 +209,15 @@ void IndexedDBDispatcher::RequestIDBCursorPrefetch( |
| scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - Send(new IndexedDBHostMsg_CursorPrefetch(ipc_cursor_id, CurrentWorkerId(), |
| - ipc_callbacks_id, n)); |
| + Send(new IndexedDBHostMsg_CursorPrefetch( |
| + ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, n)); |
| } |
| -void IndexedDBDispatcher::RequestIDBCursorPrefetchReset( |
| - int used_prefetches, int unused_prefetches, int32 ipc_cursor_id) { |
| - Send(new IndexedDBHostMsg_CursorPrefetchReset(ipc_cursor_id, |
| - used_prefetches, |
| - unused_prefetches)); |
| -} |
| - |
| -void IndexedDBDispatcher::RequestIDBCursorDelete( |
|
jsbell
2013/06/03 17:52:27
This is the only real change in the file.
|
| - WebIDBCallbacks* callbacks_ptr, |
| - int32 ipc_cursor_id) { |
| - ResetCursorPrefetchCaches(); |
| - scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| - |
| - int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - Send(new IndexedDBHostMsg_CursorDelete(ipc_cursor_id, CurrentWorkerId(), |
| - ipc_callbacks_id)); |
| +void IndexedDBDispatcher::RequestIDBCursorPrefetchReset(int used_prefetches, |
| + int unused_prefetches, |
| + int32 ipc_cursor_id) { |
| + Send(new IndexedDBHostMsg_CursorPrefetchReset( |
| + ipc_cursor_id, used_prefetches, unused_prefetches)); |
| } |
| void IndexedDBDispatcher::RequestIDBFactoryOpen( |
| @@ -246,14 +229,14 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen( |
| const string16& database_identifier) { |
| ResetCursorPrefetchCaches(); |
| scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| - scoped_ptr<WebIDBDatabaseCallbacks> |
| - database_callbacks(database_callbacks_ptr); |
| + scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks( |
| + database_callbacks_ptr); |
| IndexedDBHostMsg_FactoryOpen_Params params; |
| params.ipc_thread_id = CurrentWorkerId(); |
| params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - params.ipc_database_callbacks_id = pending_database_callbacks_.Add( |
| - database_callbacks.release()); |
| + params.ipc_database_callbacks_id = |
| + pending_database_callbacks_.Add(database_callbacks.release()); |
| params.database_identifier = database_identifier; |
| params.name = name; |
| params.transaction_id = transaction_id; |
| @@ -306,23 +289,22 @@ void IndexedDBDispatcher::RequestIDBDatabaseCreateTransaction( |
| WebIDBDatabaseCallbacks* database_callbacks_ptr, |
| WebKit::WebVector<long long> object_store_ids, |
| unsigned short mode) { |
| - scoped_ptr<WebIDBDatabaseCallbacks> |
| - database_callbacks(database_callbacks_ptr); |
| + scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks( |
| + database_callbacks_ptr); |
| IndexedDBHostMsg_DatabaseCreateTransaction_Params params; |
| params.ipc_thread_id = CurrentWorkerId(); |
| params.ipc_database_id = ipc_database_id; |
| params.transaction_id = transaction_id; |
| - params.ipc_database_callbacks_id = pending_database_callbacks_.Add( |
| - database_callbacks.release()); |
| - params.object_store_ids.assign(object_store_ids.data(), |
| - object_store_ids.data() + |
| - object_store_ids.size()); |
| + params.ipc_database_callbacks_id = |
| + pending_database_callbacks_.Add(database_callbacks.release()); |
| + params.object_store_ids |
| + .assign(object_store_ids.data(), |
| + object_store_ids.data() + object_store_ids.size()); |
| params.mode = mode; |
| Send(new IndexedDBHostMsg_DatabaseCreateTransaction(params)); |
| } |
| - |
| void IndexedDBDispatcher::RequestIDBDatabaseGet( |
| int32 ipc_database_id, |
| int64 transaction_id, |
| @@ -343,7 +325,6 @@ void IndexedDBDispatcher::RequestIDBDatabaseGet( |
| Send(new IndexedDBHostMsg_DatabaseGet(params)); |
| } |
| - |
| void IndexedDBDispatcher::RequestIDBDatabasePut( |
| int32 ipc_database_id, |
| int64 transaction_id, |
| @@ -353,17 +334,16 @@ void IndexedDBDispatcher::RequestIDBDatabasePut( |
| WebIDBDatabase::PutMode put_mode, |
| WebIDBCallbacks* callbacks, |
| const WebVector<long long>& index_ids, |
| - const WebVector<WebKit::WebVector< |
| - WebIDBKey> >& index_keys) { |
| + const WebVector<WebKit::WebVector<WebIDBKey> >& index_keys) { |
| if (value.size() > kMaxIDBValueSizeInBytes) { |
| callbacks->onError(WebIDBDatabaseError( |
| WebKit::WebIDBDatabaseExceptionUnknownError, |
| - WebString::fromUTF8( |
| - base::StringPrintf( |
| - "The serialized value is too large" |
| - " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", |
| - value.size(), kMaxIDBValueSizeInBytes).c_str()))); |
| + WebString::fromUTF8(base::StringPrintf( |
| + "The serialized value is too large" |
| + " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", |
| + value.size(), |
| + kMaxIDBValueSizeInBytes).c_str()))); |
| return; |
| } |
| @@ -378,17 +358,17 @@ void IndexedDBDispatcher::RequestIDBDatabasePut( |
| params.key = key; |
| params.put_mode = put_mode; |
| - COMPILE_ASSERT(sizeof(params.index_ids[0]) == |
| - sizeof(index_ids[0]), Cant_copy); |
| - params.index_ids.assign(index_ids.data(), |
| - index_ids.data() + index_ids.size()); |
| + COMPILE_ASSERT(sizeof(params.index_ids[0]) == sizeof(index_ids[0]), |
| + Cant_copy); |
| + params.index_ids |
| + .assign(index_ids.data(), index_ids.data() + index_ids.size()); |
| params.index_keys.resize(index_keys.size()); |
| for (size_t i = 0; i < index_keys.size(); ++i) { |
| - params.index_keys[i].resize(index_keys[i].size()); |
| - for (size_t j = 0; j < index_keys[i].size(); ++j) { |
| - params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); |
| - } |
| + params.index_keys[i].resize(index_keys[i].size()); |
| + for (size_t j = 0; j < index_keys[i].size(); ++j) { |
| + params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); |
| + } |
| } |
| Send(new IndexedDBHostMsg_DatabasePut(params)); |
| } |
| @@ -440,8 +420,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( |
| int64 transaction_id, |
| int64 object_store_id, |
| const IndexedDBKeyRange& key_range, |
| - WebKit::WebIDBCallbacks* callbacks) |
| -{ |
| + WebKit::WebIDBCallbacks* callbacks) { |
| ResetCursorPrefetchCaches(); |
| IndexedDBHostMsg_DatabaseDeleteRange_Params params; |
| init_params(params, callbacks); |
| @@ -459,9 +438,11 @@ void IndexedDBDispatcher::RequestIDBDatabaseClear( |
| WebKit::WebIDBCallbacks* callbacks_ptr) { |
| scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); |
| - Send(new IndexedDBHostMsg_DatabaseClear( |
| - CurrentWorkerId(), ipc_callbacks_id, ipc_database_id, |
| - transaction_id, object_store_id)); |
| + Send(new IndexedDBHostMsg_DatabaseClear(CurrentWorkerId(), |
| + ipc_callbacks_id, |
| + ipc_database_id, |
| + transaction_id, |
| + object_store_id)); |
| } |
| void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) { |
| @@ -493,10 +474,9 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase( |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| } |
| -void IndexedDBDispatcher::OnSuccessIndexedDBKey( |
| - int32 ipc_thread_id, |
| - int32 ipc_callbacks_id, |
| - const IndexedDBKey& key) { |
| +void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 ipc_thread_id, |
| + int32 ipc_callbacks_id, |
| + const IndexedDBKey& key) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| if (!callbacks) |
| @@ -506,7 +486,8 @@ void IndexedDBDispatcher::OnSuccessIndexedDBKey( |
| } |
| void IndexedDBDispatcher::OnSuccessStringList( |
| - int32 ipc_thread_id, int32 ipc_callbacks_id, |
| + int32 ipc_thread_id, |
| + int32 ipc_callbacks_id, |
| const std::vector<string16>& value) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| @@ -516,22 +497,23 @@ void IndexedDBDispatcher::OnSuccessStringList( |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| } |
| -void IndexedDBDispatcher::OnSuccessValue( |
| - int32 ipc_thread_id, int32 ipc_callbacks_id, |
| - const std::vector<char>& value) { |
| +void IndexedDBDispatcher::OnSuccessValue(int32 ipc_thread_id, |
| + int32 ipc_callbacks_id, |
| + const std::vector<char>& value) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| if (!callbacks) |
| return; |
| WebData web_value; |
| if (value.size()) |
| - web_value.assign(&value.front(), value.size()); |
| + web_value.assign(&value.front(), value.size()); |
| callbacks->onSuccess(web_value); |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| } |
| void IndexedDBDispatcher::OnSuccessValueWithKey( |
| - int32 ipc_thread_id, int32 ipc_callbacks_id, |
| + int32 ipc_thread_id, |
| + int32 ipc_callbacks_id, |
| const std::vector<char>& value, |
| const IndexedDBKey& primary_key, |
| const IndexedDBKeyPath& key_path) { |
| @@ -541,14 +523,14 @@ void IndexedDBDispatcher::OnSuccessValueWithKey( |
| return; |
| WebData web_value; |
| if (value.size()) |
| - web_value.assign(&value.front(), value.size()); |
| - callbacks->onSuccess(web_value, |
| - primary_key, key_path); |
| + web_value.assign(&value.front(), value.size()); |
| + callbacks->onSuccess(web_value, primary_key, key_path); |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| } |
| -void IndexedDBDispatcher::OnSuccessInteger( |
| - int32 ipc_thread_id, int32 ipc_callbacks_id, int64 value) { |
| +void IndexedDBDispatcher::OnSuccessInteger(int32 ipc_thread_id, |
| + int32 ipc_callbacks_id, |
| + int64 value) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| if (!callbacks) |
| @@ -557,8 +539,8 @@ void IndexedDBDispatcher::OnSuccessInteger( |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| } |
| -void IndexedDBDispatcher::OnSuccessUndefined( |
| - int32 ipc_thread_id, int32 ipc_callbacks_id) { |
| +void IndexedDBDispatcher::OnSuccessUndefined(int32 ipc_thread_id, |
| + int32 ipc_callbacks_id) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| if (!callbacks) |
| @@ -576,15 +558,14 @@ void IndexedDBDispatcher::OnSuccessOpenCursor( |
| const IndexedDBKey& primary_key = p.primary_key; |
| WebData web_value; |
| if (p.value.size()) |
| - web_value.assign(&p.value.front(), p.value.size()); |
| + web_value.assign(&p.value.front(), p.value.size()); |
| - WebIDBCallbacks* callbacks = |
| - pending_callbacks_.Lookup(ipc_callbacks_id); |
| + WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
| if (!callbacks) |
| return; |
| RendererWebIDBCursorImpl* cursor = |
| - new RendererWebIDBCursorImpl(ipc_object_id); |
| + new RendererWebIDBCursorImpl(ipc_object_id); |
| cursors_[ipc_object_id] = cursor; |
| callbacks->onSuccess(cursor, key, primary_key, web_value); |
| @@ -609,7 +590,7 @@ void IndexedDBDispatcher::OnSuccessCursorContinue( |
| WebData web_value; |
| if (value.size()) |
| - web_value.assign(&value.front(), value.size()); |
| + web_value.assign(&value.front(), value.size()); |
| callbacks->onSuccess(key, primary_key, web_value); |
| pending_callbacks_.Remove(ipc_callbacks_id); |
| @@ -624,8 +605,8 @@ void IndexedDBDispatcher::OnSuccessCursorPrefetch( |
| const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; |
| std::vector<WebData> values(p.values.size()); |
| for (size_t i = 0; i < p.values.size(); ++i) { |
| - if (p.values[i].size()) |
| - values[i].assign(&p.values[i].front(), p.values[i].size()); |
| + if (p.values[i].size()) |
| + values[i].assign(&p.values[i].front(), p.values[i].size()); |
| } |
| RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
| DCHECK(cursor); |
| @@ -656,9 +637,7 @@ void IndexedDBDispatcher::OnUpgradeNeeded( |
| databases_[p.ipc_database_id] = new RendererWebIDBDatabaseImpl( |
| p.ipc_database_id, p.ipc_database_callbacks_id); |
| callbacks->onUpgradeNeeded( |
| - p.old_version, |
| - databases_[p.ipc_database_id], |
| - metadata); |
| + p.old_version, databases_[p.ipc_database_id], metadata); |
| } |
| void IndexedDBDispatcher::OnError(int32 ipc_thread_id, |
| @@ -676,7 +655,8 @@ void IndexedDBDispatcher::OnError(int32 ipc_thread_id, |
| void IndexedDBDispatcher::OnAbort(int32 ipc_thread_id, |
| int32 ipc_database_callbacks_id, |
| int64 transaction_id, |
| - int code, const string16& message) { |
| + int code, |
| + const string16& message) { |
| DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| WebIDBDatabaseCallbacks* callbacks = |
| pending_database_callbacks_.Lookup(ipc_database_callbacks_id); |