diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 21:37:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 21:37:47 +0000 |
commit | cb4c5fbce80d3adb0faf6056c0e255aa481757d8 (patch) | |
tree | 166729f78dce22431eee769ab58fc241484c0b69 | |
parent | ef32ea677641f25e47a40a101501b35b8e3a1bd0 (diff) | |
download | chromium_src-cb4c5fbce80d3adb0faf6056c0e255aa481757d8.zip chromium_src-cb4c5fbce80d3adb0faf6056c0e255aa481757d8.tar.gz chromium_src-cb4c5fbce80d3adb0faf6056c0e255aa481757d8.tar.bz2 |
Move SerializedScriptValue to content/public/common and put it into the content namespace.
BUG=98716
Review URL: http://codereview.chromium.org/8372009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106781 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 149 insertions, 119 deletions
diff --git a/chrome/browser/idbbindingutilities_browsertest.cc b/chrome/browser/idbbindingutilities_browsertest.cc index ed126e7..1785fb6 100644 --- a/chrome/browser/idbbindingutilities_browsertest.cc +++ b/chrome/browser/idbbindingutilities_browsertest.cc @@ -9,8 +9,8 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/utility_process_host.h" #include "content/common/indexed_db_key.h" -#include "content/common/serialized_script_value.h" #include "content/common/utility_messages.h" +#include "content/public/common/serialized_script_value.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -125,12 +125,13 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client { value_for_key_path_failed_ = failed; } - void SetExpectedValue(const SerializedScriptValue& expected_value) { + void SetExpectedValue(const content::SerializedScriptValue& expected_value) { expected_value_ = expected_value; } void CheckValuesForKeyPath( - int id, const std::vector<SerializedScriptValue>& serialized_values, + int id, + const std::vector<content::SerializedScriptValue>& serialized_values, const string16& key_path) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( @@ -147,7 +148,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client { } void CheckInjectValue(const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( @@ -203,7 +204,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client { new MessageLoop::QuitTask()); } - void OnInjectIDBKeyFinished(const SerializedScriptValue& new_value) { + void OnInjectIDBKeyFinished(const content::SerializedScriptValue& new_value) { EXPECT_EQ(expected_value_.data(), new_value.data()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask()); @@ -215,7 +216,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client { std::vector<IndexedDBKey> expected_keys_; UtilityProcessHost* utility_process_host_; bool value_for_key_path_failed_; - SerializedScriptValue expected_value_; + content::SerializedScriptValue expected_value_; }; // This test fixture runs in the UI thread. However, most of the work done by @@ -241,13 +242,14 @@ class ScopedIDBKeyPathHelper { key_path_helper_->SetExpectedKeys(id, expected_keys, failed); } - void SetExpectedValue(const SerializedScriptValue& expected_value) { + void SetExpectedValue(const content::SerializedScriptValue& expected_value) { key_path_helper_->SetExpectedValue(expected_value); } void CheckValuesForKeyPath( int id, - const std::vector<SerializedScriptValue>& serialized_script_values, + const std::vector<content::SerializedScriptValue>& + serialized_script_values, const string16& key_path) { key_path_helper_->CheckValuesForKeyPath(id, serialized_script_values, key_path); @@ -255,7 +257,7 @@ class ScopedIDBKeyPathHelper { } void CheckInjectValue(const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path) { key_path_helper_->CheckInjectValue(key, value, key_path); ui_test_utils::RunMessageLoop(); @@ -280,11 +282,11 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathExtract) { scoped_helper.SetExpectedKeys(kId, expected_keys, false); char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - std::vector<SerializedScriptValue> serialized_values; - serialized_values.push_back( - SerializedScriptValue(false, false, string16(data, arraysize(data)))); + std::vector<content::SerializedScriptValue> serialized_values; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data, arraysize(data)))); serialized_values.push_back( - SerializedScriptValue(true, false, string16())); + content::SerializedScriptValue(true, false, string16())); scoped_helper.CheckValuesForKeyPath( kId, serialized_values, UTF8ToUTF16("foo")); } @@ -301,11 +303,11 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathPropertyNotAvailable) { scoped_helper.SetExpectedKeys(kId, expected_keys, false); char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - std::vector<SerializedScriptValue> serialized_values; + std::vector<content::SerializedScriptValue> serialized_values; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data, arraysize(data)))); serialized_values.push_back( - SerializedScriptValue(false, false, string16(data, arraysize(data)))); - serialized_values.push_back( - SerializedScriptValue(true, false, string16())); + content::SerializedScriptValue(true, false, string16())); scoped_helper.CheckValuesForKeyPath(kId, serialized_values, UTF8ToUTF16("PropertyNotAvailable")); } @@ -322,11 +324,11 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { scoped_helper.SetExpectedKeys(kId, expected_keys, true); char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - std::vector<SerializedScriptValue> serialized_values; - serialized_values.push_back( - SerializedScriptValue(false, false, string16(data, arraysize(data)))); + std::vector<content::SerializedScriptValue> serialized_values; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data, arraysize(data)))); serialized_values.push_back( - SerializedScriptValue(true, false, string16())); + content::SerializedScriptValue(true, false, string16())); scoped_helper.CheckValuesForKeyPath(kId, serialized_values, UTF8ToUTF16("!+Invalid[KeyPath[[[")); @@ -344,7 +346,8 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, InjectIDBKey) { // {foo: 'zoo'} const char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - SerializedScriptValue value(false, false, string16(data, arraysize(data))); + content::SerializedScriptValue value( + false, false, string16(data, arraysize(data))); IndexedDBKey key; key.SetString(UTF8ToUTF16("myNewKey")); @@ -352,9 +355,8 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, InjectIDBKey) { const char16 expected_data[] = {0x353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x353, 0x6162, 0x5372, 0x6d08, 0x4e79, 0x7765, 0x654b, 0x7b79, 0x2}; - SerializedScriptValue expected_value(false, false, - string16(expected_data, - arraysize(expected_data))); + content::SerializedScriptValue expected_value( + false, false, string16(expected_data, arraysize(expected_data))); ScopedIDBKeyPathHelper scoped_helper; scoped_helper.SetExpectedValue(expected_value); @@ -362,6 +364,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, InjectIDBKey) { // https://bugs.webkit.org/show_bug.cgi?id=63481 land. // scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bar")); - scoped_helper.SetExpectedValue(SerializedScriptValue()); // Expect null. + // Expect null. + scoped_helper.SetExpectedValue(content::SerializedScriptValue()); scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bad.key.path")); } diff --git a/chrome/common/chrome_utility_messages.h b/chrome/common/chrome_utility_messages.h index 07778f5..8ec3c80 100644 --- a/chrome/common/chrome_utility_messages.h +++ b/chrome/common/chrome_utility_messages.h @@ -12,8 +12,8 @@ #include "base/platform_file.h" #include "base/values.h" #include "chrome/common/extensions/update_manifest.h" -#include "content/common/serialized_script_value.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/serialized_script_value.h" #include "ipc/ipc_message_macros.h" #include "printing/backend/print_backend.h" #include "printing/page_range.h" diff --git a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc index a10e0afd..ff2d2111 100644 --- a/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc +++ b/content/browser/in_process_webkit/browser_webkitplatformsupport_impl.cc @@ -9,7 +9,7 @@ #include "content/browser/in_process_webkit/dom_storage_message_filter.h" #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" #include "content/common/indexed_db_key.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" @@ -155,11 +155,11 @@ BrowserWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( const WebKit::WebString& keyPath, WebKit::WebVector<WebKit::WebIDBKey>& keys) { - std::vector<SerializedScriptValue> std_values; + std::vector<content::SerializedScriptValue> std_values; size_t size = values.size(); std_values.reserve(size); for (size_t i = 0; i < size; ++i) - std_values.push_back(SerializedScriptValue(values[i])); + std_values.push_back(content::SerializedScriptValue(values[i])); std::vector<IndexedDBKey> std_keys; IndexedDBKeyUtilityClient:: @@ -174,5 +174,5 @@ BrowserWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( const WebKit::WebIDBKey& key, const WebKit::WebSerializedScriptValue& value, const WebKit::WebString& keyPath) { return IndexedDBKeyUtilityClient::InjectIDBKeyIntoSerializedValue( - IndexedDBKey(key), SerializedScriptValue(value), keyPath); + IndexedDBKey(key), content::SerializedScriptValue(value), keyPath); } diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.cc b/content/browser/in_process_webkit/indexed_db_callbacks.cc index aa4dd61..01b4b63 100644 --- a/content/browser/in_process_webkit/indexed_db_callbacks.cc +++ b/content/browser/in_process_webkit/indexed_db_callbacks.cc @@ -31,14 +31,14 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor( response_id(), object_id, IndexedDBKey(idb_object->key()), IndexedDBKey(idb_object->primaryKey()), - SerializedScriptValue(idb_object->value()))); + content::SerializedScriptValue(idb_object->value()))); } void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( const WebKit::WebSerializedScriptValue& value) { dispatcher_host()->Send( new IndexedDBMsg_CallbacksSuccessSerializedScriptValue( - response_id(), SerializedScriptValue(value))); + response_id(), content::SerializedScriptValue(value))); } void IndexedDBCallbacks<WebKit::WebIDBKey>::onSuccess( @@ -64,5 +64,5 @@ void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess( const WebKit::WebSerializedScriptValue& value) { dispatcher_host()->Send( new IndexedDBMsg_CallbacksSuccessSerializedScriptValue( - response_id(), SerializedScriptValue(value))); + response_id(), content::SerializedScriptValue(value))); } diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index b6f23c2..85997b5 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -942,18 +942,18 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrimaryKey( void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue( int32 object_id, - SerializedScriptValue* script_value) { + content::SerializedScriptValue* script_value) { WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id); if (!idb_cursor) return; - *script_value = SerializedScriptValue(idb_cursor->value()); + *script_value = content::SerializedScriptValue(idb_cursor->value()); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( int32 cursor_id, int32 response_id, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h index a028b9e..874587c 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -14,7 +14,6 @@ class IndexedDBKey; class NullableString16; -class SerializedScriptValue; struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; @@ -33,6 +32,10 @@ class WebIDBObjectStore; class WebIDBTransaction; } +namespace content { +class SerializedScriptValue; +} + // Handles all IndexedDB related messages from a particular renderer process. class IndexedDBDispatcherHost : public BrowserMessageFilter { public: @@ -223,10 +226,10 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter { void OnKey(int32 idb_object_store_id, IndexedDBKey* key); void OnPrimaryKey(int32 idb_object_store_id, IndexedDBKey* primary_key); void OnValue(int32 idb_object_store_id, - SerializedScriptValue* script_value); + content::SerializedScriptValue* script_value); void OnUpdate(int32 idb_object_store_id, int32 response_id, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, WebKit::WebExceptionCode* ec); void OnContinue(int32 idb_object_store_id, int32 response_id, diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc index b9ded5a..397e293 100644 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc +++ b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc @@ -11,7 +11,7 @@ #include "content/common/indexed_db_key.h" #include "content/common/indexed_db_messages.h" #include "content/common/utility_messages.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" // This class is used to obtain IndexedDBKeys from SerializedScriptValues // given an IDBKeyPath. It uses UtilityProcess to do this inside a sandbox @@ -31,15 +31,15 @@ class KeyUtilityClientImpl // Synchronously obtain the |keys| from |values| for the given |key_path|. void CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path, std::vector<IndexedDBKey>* keys); // Synchronously inject |key| into |value| using the given |key_path|, // returning the new value. - SerializedScriptValue InjectIDBKeyIntoSerializedValue( + content::SerializedScriptValue InjectIDBKeyIntoSerializedValue( const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path); private: @@ -55,7 +55,7 @@ class KeyUtilityClientImpl void OnIDBKeysFromValuesAndKeyPathSucceeded( int id, const std::vector<IndexedDBKey>& keys); void OnIDBKeysFromValuesAndKeyPathFailed(int id); - void OnInjectIDBKeyFinished(const SerializedScriptValue& value); + void OnInjectIDBKeyFinished(const content::SerializedScriptValue& value); private: KeyUtilityClientImpl* parent_; @@ -70,16 +70,16 @@ class KeyUtilityClientImpl void StartUtilityProcessInternal(); void EndUtilityProcessInternal(); void CallStartIDBKeyFromValueAndKeyPathFromIOThread( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path); void CallStartInjectIDBKeyFromIOThread( const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path); void SetKeys(const std::vector<IndexedDBKey>& keys); void FinishCreatingKeys(); - void SetValueAfterInjection(const SerializedScriptValue& value); + void SetValueAfterInjection(const content::SerializedScriptValue& value); void FinishInjectingKey(); base::WaitableEvent waitable_event_; @@ -95,7 +95,7 @@ class KeyUtilityClientImpl }; State state_; std::vector<IndexedDBKey> keys_; - SerializedScriptValue value_after_injection_; + content::SerializedScriptValue value_after_injection_; // Used in the IO thread. UtilityProcessHost* utility_process_host_; @@ -131,7 +131,7 @@ void IndexedDBKeyUtilityClient::Shutdown() { // static void IndexedDBKeyUtilityClient::CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path, std::vector<IndexedDBKey>* keys) { IndexedDBKeyUtilityClient* instance = client_instance.Pointer(); @@ -151,14 +151,14 @@ void IndexedDBKeyUtilityClient::CreateIDBKeysFromSerializedValuesAndKeyPath( } // static -SerializedScriptValue +content::SerializedScriptValue IndexedDBKeyUtilityClient::InjectIDBKeyIntoSerializedValue( - const IndexedDBKey& key, const SerializedScriptValue& value, + const IndexedDBKey& key, const content::SerializedScriptValue& value, const string16& key_path) { IndexedDBKeyUtilityClient* instance = client_instance.Pointer(); if (instance->is_shutdown_) - return SerializedScriptValue(); + return content::SerializedScriptValue(); if (!instance->impl_) { instance->impl_ = new KeyUtilityClientImpl(); @@ -204,7 +204,7 @@ void KeyUtilityClientImpl::StartUtilityProcess() { } void KeyUtilityClientImpl::CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path, std::vector<IndexedDBKey>* keys) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); @@ -223,13 +223,14 @@ void KeyUtilityClientImpl::CreateIDBKeysFromSerializedValuesAndKeyPath( *keys = keys_; } -SerializedScriptValue KeyUtilityClientImpl::InjectIDBKeyIntoSerializedValue( - const IndexedDBKey& key, - const SerializedScriptValue& value, - const string16& key_path) { +content::SerializedScriptValue + KeyUtilityClientImpl::InjectIDBKeyIntoSerializedValue( + const IndexedDBKey& key, + const content::SerializedScriptValue& value, + const string16& key_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); if (state_ == STATE_SHUTDOWN) - return SerializedScriptValue(); + return content::SerializedScriptValue(); DCHECK(state_ == STATE_INITIALIZED); @@ -294,7 +295,7 @@ void KeyUtilityClientImpl::EndUtilityProcessInternal() { } void KeyUtilityClientImpl::CallStartIDBKeyFromValueAndKeyPathFromIOThread( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( @@ -312,7 +313,7 @@ void KeyUtilityClientImpl::CallStartIDBKeyFromValueAndKeyPathFromIOThread( void KeyUtilityClientImpl::CallStartInjectIDBKeyFromIOThread( const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( @@ -339,7 +340,7 @@ void KeyUtilityClientImpl::FinishCreatingKeys() { } void KeyUtilityClientImpl::SetValueAfterInjection( - const SerializedScriptValue& value) { + const content::SerializedScriptValue& value) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); value_after_injection_ = value; } @@ -381,7 +382,7 @@ void KeyUtilityClientImpl::Client::OnIDBKeysFromValuesAndKeyPathSucceeded( } void KeyUtilityClientImpl::Client::OnInjectIDBKeyFinished( - const SerializedScriptValue& value) { + const content::SerializedScriptValue& value) { parent_->SetValueAfterInjection(value); parent_->FinishInjectingKey(); } diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.h b/content/browser/in_process_webkit/indexed_db_key_utility_client.h index d8bebc6..ca97235 100644 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.h +++ b/content/browser/in_process_webkit/indexed_db_key_utility_client.h @@ -13,7 +13,6 @@ #include "content/common/content_export.h" class IndexedDBKey; -class SerializedScriptValue; class KeyUtilityClientImpl; namespace base { @@ -21,6 +20,10 @@ template <typename T> struct DefaultLazyInstanceTraits; } // namespace base +namespace content { +class SerializedScriptValue; +} + // Class for obtaining IndexedDBKeys from the SerializedScriptValues given // an IDBKeyPath. This class is a thin singleton wrapper around the // KeyUtilityClientImpl, which does the real work. @@ -28,15 +31,15 @@ class IndexedDBKeyUtilityClient { public: // Synchronously obtain the |keys| from |values| for the given |key_path|. static void CreateIDBKeysFromSerializedValuesAndKeyPath( - const std::vector<SerializedScriptValue>& values, + const std::vector<content::SerializedScriptValue>& values, const string16& key_path, std::vector<IndexedDBKey>* keys); // Synchronously inject |key| into |value| using |key_path|. Returns the new // value. - static SerializedScriptValue InjectIDBKeyIntoSerializedValue( + static content::SerializedScriptValue InjectIDBKeyIntoSerializedValue( const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path); // Shut down the underlying implementation. Must be called on the IO thread. diff --git a/content/common/indexed_db_messages.h b/content/common/indexed_db_messages.h index ab56459..03bb03a 100644 --- a/content/common/indexed_db_messages.h +++ b/content/common/indexed_db_messages.h @@ -8,7 +8,7 @@ #include "content/common/indexed_db_key.h" #include "content/common/indexed_db_param_traits.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" @@ -95,7 +95,7 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStorePut_Params) // The id any response should contain. IPC_STRUCT_MEMBER(int32, response_id) // The value to set. - IPC_STRUCT_MEMBER(SerializedScriptValue, serialized_value) + IPC_STRUCT_MEMBER(content::SerializedScriptValue, serialized_value) // The key to set it on (may not be "valid"/set in some cases). IPC_STRUCT_MEMBER(IndexedDBKey, key) // Whether this is an add or a put. @@ -146,7 +146,7 @@ IPC_MESSAGE_CONTROL5(IndexedDBMsg_CallbacksSuccessIDBCursor, int32 /* cursor_id */, IndexedDBKey /* key */, IndexedDBKey /* primary key */, - SerializedScriptValue /* script_value */) + content::SerializedScriptValue /* script_value */) IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, int32 /* response_id */, int32 /* idb_database_id */) @@ -158,7 +158,7 @@ IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction, int32 /* idb_transaction_id */) IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, int32 /* response_id */, - SerializedScriptValue /* serialized_script_value */) + content::SerializedScriptValue /* value */) IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessStringList, int32 /* response_id */, std::vector<string16> /* dom_string_list */) @@ -190,7 +190,7 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection, IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate, int32, /* idb_cursor_id */ int32, /* response_id */ - SerializedScriptValue, /* value */ + content::SerializedScriptValue, /* value */ WebKit::WebExceptionCode /* ec */) // WebIDBCursor::continue() message. diff --git a/content/common/indexed_db_param_traits.cc b/content/common/indexed_db_param_traits.cc index 4c9d5ab..52340ba 100644 --- a/content/common/indexed_db_param_traits.cc +++ b/content/common/indexed_db_param_traits.cc @@ -5,21 +5,21 @@ #include "content/common/indexed_db_param_traits.h" #include "content/common/indexed_db_key.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "ipc/ipc_message_utils.h" namespace IPC { -void ParamTraits<SerializedScriptValue>::Write(Message* m, - const param_type& p) { +void ParamTraits<content::SerializedScriptValue>::Write(Message* m, + const param_type& p) { WriteParam(m, p.is_null()); WriteParam(m, p.is_invalid()); WriteParam(m, p.data()); } -bool ParamTraits<SerializedScriptValue>::Read(const Message* m, - void** iter, - param_type* r) { +bool ParamTraits<content::SerializedScriptValue>::Read(const Message* m, + void** iter, + param_type* r) { bool is_null; bool is_invalid; string16 data; @@ -35,8 +35,8 @@ bool ParamTraits<SerializedScriptValue>::Read(const Message* m, return true; } -void ParamTraits<SerializedScriptValue>::Log(const param_type& p, - std::string* l) { +void ParamTraits<content::SerializedScriptValue>::Log(const param_type& p, + std::string* l) { l->append("<SerializedScriptValue>("); LogParam(p.is_null(), l); l->append(", "); diff --git a/content/common/indexed_db_param_traits.h b/content/common/indexed_db_param_traits.h index 2045bdd..d94c1bd 100644 --- a/content/common/indexed_db_param_traits.h +++ b/content/common/indexed_db_param_traits.h @@ -10,7 +10,10 @@ #include "ipc/ipc_param_traits.h" class IndexedDBKey; + +namespace content { class SerializedScriptValue; +} namespace IPC { @@ -20,8 +23,8 @@ namespace IPC { // never actually used by that target). template <> -struct ParamTraits<SerializedScriptValue> { - typedef SerializedScriptValue param_type; +struct ParamTraits<content::SerializedScriptValue> { + typedef content::SerializedScriptValue param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); static void Log(const param_type& p, std::string* l); diff --git a/content/common/utility_messages.h b/content/common/utility_messages.h index 05dcde5..4b197ac 100644 --- a/content/common/utility_messages.h +++ b/content/common/utility_messages.h @@ -10,8 +10,8 @@ #include "base/basictypes.h" #include "content/common/indexed_db_key.h" #include "content/common/indexed_db_param_traits.h" -#include "content/common/serialized_script_value.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/serialized_script_value.h" #include "ipc/ipc_message_macros.h" #include "webkit/plugins/webplugininfo.h" @@ -25,12 +25,12 @@ // SerializedScriptValue vector and reply with the corresponding IDBKeys. IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath, int, // id - std::vector<SerializedScriptValue>, + std::vector<content::SerializedScriptValue>, string16) // IDBKeyPath IPC_MESSAGE_CONTROL3(UtilityMsg_InjectIDBKey, IndexedDBKey /* key */, - SerializedScriptValue /* value */, + content::SerializedScriptValue /* value */, string16 /* key path*/) // Tells the utility process that it's running in batch mode. @@ -64,7 +64,7 @@ IPC_MESSAGE_CONTROL1(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, // Reply when the utility process has finished injecting an IDBKey into // a SerializedScriptValue. IPC_MESSAGE_CONTROL1(UtilityHostMsg_InjectIDBKey_Finished, - SerializedScriptValue /* new value */) + content::SerializedScriptValue /* new value */) #if defined(OS_POSIX) // Notifies the browser when a plugin failed to load so the two processes can diff --git a/content/content_common.gypi b/content/content_common.gypi index 1a622d3..0eb7748 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -43,6 +43,8 @@ 'public/common/pepper_plugin_info.h', 'public/common/resource_dispatcher_delegate.h', 'public/common/security_style.h', + 'public/common/serialized_script_value.cc', + 'public/common/serialized_script_value.h', 'public/common/url_constants.cc', 'public/common/url_constants.h', 'public/common/view_types.h', @@ -214,8 +216,6 @@ 'common/section_util_win.h', 'common/sensors.h', 'common/sensors_listener.h', - 'common/serialized_script_value.cc', - 'common/serialized_script_value.h', 'common/set_process_title.cc', 'common/set_process_title.h', 'common/set_process_title_linux.cc', diff --git a/content/common/serialized_script_value.cc b/content/public/common/serialized_script_value.cc index 4d6a658..880d045 100644 --- a/content/common/serialized_script_value.cc +++ b/content/public/common/serialized_script_value.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" using WebKit::WebSerializedScriptValue; +namespace content { + SerializedScriptValue::SerializedScriptValue() : is_null_(true), is_invalid_(false) { @@ -40,3 +42,5 @@ void SerializedScriptValue::set_web_serialized_script_value( is_invalid_ = value.isNull() ? false : value.toString().isNull(); data_ = value.isNull() ? string16() : static_cast<string16>(value.toString()); } + +} // namespace content diff --git a/content/common/serialized_script_value.h b/content/public/common/serialized_script_value.h index f6f0515..173f311 100644 --- a/content/common/serialized_script_value.h +++ b/content/public/common/serialized_script_value.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ -#define CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ +#ifndef CONTENT_PUBLIC_COMMON_SERIALIZED_SCRIPT_VALUE_H_ +#define CONTENT_PUBLIC_COMMON_SERIALIZED_SCRIPT_VALUE_H_ #pragma once #include "base/string16.h" @@ -13,6 +13,8 @@ namespace WebKit { class WebSerializedScriptValue; } +namespace content { + class CONTENT_EXPORT SerializedScriptValue { public: SerializedScriptValue(); @@ -39,4 +41,6 @@ class CONTENT_EXPORT SerializedScriptValue { string16 data_; // The wire string format of the serialized script value. }; -#endif // CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_SERIALIZED_SCRIPT_VALUE_H_ diff --git a/content/renderer/indexed_db_dispatcher.cc b/content/renderer/indexed_db_dispatcher.cc index aba628b..c3eea0e 100644 --- a/content/renderer/indexed_db_dispatcher.cc +++ b/content/renderer/indexed_db_dispatcher.cc @@ -64,7 +64,7 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { } void IndexedDBDispatcher::RequestIDBCursorUpdate( - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, WebIDBCallbacks* callbacks_ptr, int32 idb_cursor_id, WebExceptionCode* ec) { @@ -296,7 +296,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet( } void IndexedDBDispatcher::RequestIDBObjectStorePut( - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const IndexedDBKey& key, WebKit::WebIDBObjectStore::PutMode put_mode, WebIDBCallbacks* callbacks_ptr, @@ -419,7 +419,7 @@ void IndexedDBDispatcher::OnSuccessStringList( } void IndexedDBDispatcher::OnSuccessSerializedScriptValue( - int32 response_id, const SerializedScriptValue& value) { + int32 response_id, const content::SerializedScriptValue& value) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); callbacks->onSuccess(value); pending_callbacks_.Remove(response_id); @@ -427,7 +427,7 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValue( void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, int32 object_id, const IndexedDBKey& key, const IndexedDBKey& primaryKey, - const SerializedScriptValue& value) { + const content::SerializedScriptValue& value) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(repsonse_id); callbacks->onSuccess(new RendererWebIDBCursorImpl(object_id, key, diff --git a/content/renderer/indexed_db_dispatcher.h b/content/renderer/indexed_db_dispatcher.h index 059abc4..e30fa95 100644 --- a/content/renderer/indexed_db_dispatcher.h +++ b/content/renderer/indexed_db_dispatcher.h @@ -16,7 +16,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h" class IndexedDBKey; -class SerializedScriptValue; namespace WebKit { class WebDOMStringList; @@ -25,6 +24,10 @@ class WebIDBKeyRange; class WebIDBTransaction; } +namespace content { +class SerializedScriptValue; +} + // Handle the indexed db related communication for this entire renderer. class IndexedDBDispatcher : public IPC::Channel::Listener { public: @@ -52,7 +55,7 @@ class IndexedDBDispatcher : public IPC::Channel::Listener { WebKit::WebFrame* web_frame); void RequestIDBCursorUpdate( - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, WebKit::WebIDBCallbacks* callbacks_ptr, int32 idb_cursor_id, WebKit::WebExceptionCode* ec); @@ -115,7 +118,7 @@ class IndexedDBDispatcher : public IPC::Channel::Listener { const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode* ec); - void RequestIDBObjectStorePut(const SerializedScriptValue& value, + void RequestIDBObjectStorePut(const content::SerializedScriptValue& value, const IndexedDBKey& key, WebKit::WebIDBObjectStore::PutMode putMode, WebKit::WebIDBCallbacks* callbacks, @@ -159,11 +162,12 @@ class IndexedDBDispatcher : public IPC::Channel::Listener { void OnSuccessOpenCursor(int32 response_id, int32 object_id, const IndexedDBKey& key, const IndexedDBKey& primary_key, - const SerializedScriptValue& value); + const content::SerializedScriptValue& value); void OnSuccessStringList(int32 response_id, const std::vector<string16>& value); - void OnSuccessSerializedScriptValue(int32 response_id, - const SerializedScriptValue& value); + void OnSuccessSerializedScriptValue( + int32 response_id, + const content::SerializedScriptValue& value); void OnError(int32 response_id, int code, const string16& message); void OnBlocked(int32 response_id); void OnAbort(int32 transaction_id); diff --git a/content/renderer/renderer_webidbcursor_impl.cc b/content/renderer/renderer_webidbcursor_impl.cc index 1837e2f..82996f4 100644 --- a/content/renderer/renderer_webidbcursor_impl.cc +++ b/content/renderer/renderer_webidbcursor_impl.cc @@ -15,7 +15,7 @@ using WebKit::WebSerializedScriptValue; RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id, const IndexedDBKey& key, const IndexedDBKey& primary_key, - const SerializedScriptValue& value) + const content::SerializedScriptValue& value) : idb_cursor_id_(idb_cursor_id), key_(key), primary_key_(primary_key), @@ -55,8 +55,8 @@ void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThreadImpl::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, - idb_cursor_id_, &ec); + dispatcher->RequestIDBCursorUpdate( + content::SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec); } void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, diff --git a/content/renderer/renderer_webidbcursor_impl.h b/content/renderer/renderer_webidbcursor_impl.h index 95e2fad..bb1c165 100644 --- a/content/renderer/renderer_webidbcursor_impl.h +++ b/content/renderer/renderer_webidbcursor_impl.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "content/common/indexed_db_key.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" @@ -17,7 +17,7 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor { public: RendererWebIDBCursorImpl(int32 idb_cursor_id, const IndexedDBKey& key, const IndexedDBKey& primary_key, - const SerializedScriptValue& value); + const content::SerializedScriptValue& value); virtual ~RendererWebIDBCursorImpl(); virtual unsigned short direction() const; @@ -37,7 +37,7 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor { int32 idb_cursor_id_; const IndexedDBKey key_; const IndexedDBKey primary_key_; - const SerializedScriptValue value_; + const content::SerializedScriptValue value_; }; #endif // CONTENT_RENDERER_RENDERER_WEBIDBCURSOR_IMPL_H_ diff --git a/content/renderer/renderer_webidbobjectstore_impl.cc b/content/renderer/renderer_webidbobjectstore_impl.cc index 8f65bf4..70ebc0a 100644 --- a/content/renderer/renderer_webidbobjectstore_impl.cc +++ b/content/renderer/renderer_webidbobjectstore_impl.cc @@ -5,7 +5,7 @@ #include "content/renderer/renderer_webidbobjectstore_impl.h" #include "content/common/indexed_db_messages.h" -#include "content/common/serialized_script_value.h" +#include "content/public/common/serialized_script_value.h" #include "content/renderer/indexed_db_dispatcher.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/renderer_webidbindex_impl.h" @@ -90,8 +90,8 @@ void RendererWebIDBObjectStoreImpl::put( IndexedDBDispatcher* dispatcher = RenderThreadImpl::current()->indexed_db_dispatcher(); dispatcher->RequestIDBObjectStorePut( - SerializedScriptValue(value), IndexedDBKey(key), put_mode, callbacks, - idb_object_store_id_, transaction, &ec); + content::SerializedScriptValue(value), IndexedDBKey(key), put_mode, + callbacks, idb_object_store_id_, transaction, &ec); } void RendererWebIDBObjectStoreImpl::deleteFunction( diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index 393dc3b..a743c27 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -72,7 +72,7 @@ bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( int id, - const std::vector<SerializedScriptValue>& serialized_script_values, + const std::vector<content::SerializedScriptValue>& serialized_script_values, const string16& idb_key_path) { std::vector<WebKit::WebSerializedScriptValue> web_values; ConvertVector(serialized_script_values, &web_values); @@ -89,11 +89,12 @@ void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( ReleaseProcessIfNeeded(); } -void UtilityThreadImpl::OnInjectIDBKey(const IndexedDBKey& key, - const SerializedScriptValue& value, - const string16& key_path) { - SerializedScriptValue new_value(webkit_glue::InjectIDBKey(key, value, - key_path)); +void UtilityThreadImpl::OnInjectIDBKey( + const IndexedDBKey& key, + const content::SerializedScriptValue& value, + const string16& key_path) { + content::SerializedScriptValue new_value( + webkit_glue::InjectIDBKey(key, value, key_path)); Send(new UtilityHostMsg_InjectIDBKey_Finished(new_value)); ReleaseProcessIfNeeded(); } diff --git a/content/utility/utility_thread_impl.h b/content/utility/utility_thread_impl.h index d7352d2..149fc6e 100644 --- a/content/utility/utility_thread_impl.h +++ b/content/utility/utility_thread_impl.h @@ -18,7 +18,10 @@ class FilePath; class IndexedDBKey; + +namespace content { class SerializedScriptValue; +} namespace webkit { struct WebPluginInfo; @@ -46,10 +49,11 @@ class UtilityThreadImpl : public content::UtilityThread, // IPC message handlers. void OnIDBKeysFromValuesAndKeyPath( int id, - const std::vector<SerializedScriptValue>& serialized_script_values, + const std::vector<content::SerializedScriptValue>& + serialized_script_values, const string16& idb_key_path); void OnInjectIDBKey(const IndexedDBKey& key, - const SerializedScriptValue& value, + const content::SerializedScriptValue& value, const string16& key_path); void OnBatchModeStarted(); void OnBatchModeFinished(); |