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/utility/utility_thread_impl.h" | 5 #include "content/utility/utility_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "content/common/child_process.h" | 12 #include "content/common/child_process.h" |
13 #include "content/common/child_process_messages.h" | 13 #include "content/common/child_process_messages.h" |
14 #include "content/common/indexed_db/indexed_db_key.h" | 14 #include "content/common/indexed_db/indexed_db_key.h" |
| 15 #include "content/common/indexed_db/indexed_db_key_path.h" |
15 #include "content/common/utility_messages.h" | 16 #include "content/common/utility_messages.h" |
16 #include "content/common/webkitplatformsupport_impl.h" | 17 #include "content/common/webkitplatformsupport_impl.h" |
17 #include "content/public/utility/content_utility_client.h" | 18 #include "content/public/utility/content_utility_client.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
21 #include "webkit/glue/idb_bindings.h" | 22 #include "webkit/glue/idb_bindings.h" |
22 #include "webkit/plugins/npapi/plugin_list.h" | 23 #include "webkit/plugins/npapi/plugin_list.h" |
23 | 24 |
24 #if defined(TOOLKIT_GTK) | 25 #if defined(TOOLKIT_GTK) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) | 88 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) |
88 #endif // OS_POSIX | 89 #endif // OS_POSIX |
89 IPC_MESSAGE_UNHANDLED(handled = false) | 90 IPC_MESSAGE_UNHANDLED(handled = false) |
90 IPC_END_MESSAGE_MAP() | 91 IPC_END_MESSAGE_MAP() |
91 return handled; | 92 return handled; |
92 } | 93 } |
93 | 94 |
94 void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( | 95 void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( |
95 int id, | 96 int id, |
96 const std::vector<content::SerializedScriptValue>& serialized_script_values, | 97 const std::vector<content::SerializedScriptValue>& serialized_script_values, |
97 const string16& idb_key_path) { | 98 const content::IndexedDBKeyPath& idb_key_path) { |
98 std::vector<WebKit::WebSerializedScriptValue> web_values; | 99 std::vector<WebKit::WebSerializedScriptValue> web_values; |
99 ConvertVector(serialized_script_values, &web_values); | 100 ConvertVector(serialized_script_values, &web_values); |
100 std::vector<WebKit::WebIDBKey> web_keys; | 101 std::vector<WebKit::WebIDBKey> web_keys; |
101 bool error = webkit_glue::IDBKeysFromValuesAndKeyPath( | 102 webkit_glue::IDBKeysFromValuesAndKeyPath( |
102 web_values, idb_key_path, &web_keys); | 103 web_values, idb_key_path, &web_keys); |
103 if (error) { | |
104 Send(new UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed(id)); | |
105 return; | |
106 } | |
107 std::vector<IndexedDBKey> keys; | 104 std::vector<IndexedDBKey> keys; |
108 ConvertVector(web_keys, &keys); | 105 ConvertVector(web_keys, &keys); |
109 Send(new UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded(id, keys)); | 106 Send(new UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded(id, keys)); |
110 ReleaseProcessIfNeeded(); | 107 ReleaseProcessIfNeeded(); |
111 } | 108 } |
112 | 109 |
113 void UtilityThreadImpl::OnInjectIDBKey( | 110 void UtilityThreadImpl::OnInjectIDBKey( |
114 const IndexedDBKey& key, | 111 const IndexedDBKey& key, |
115 const content::SerializedScriptValue& value, | 112 const content::SerializedScriptValue& value, |
116 const string16& key_path) { | 113 const content::IndexedDBKeyPath& key_path) { |
117 content::SerializedScriptValue new_value( | 114 content::SerializedScriptValue new_value( |
118 webkit_glue::InjectIDBKey(key, value, key_path)); | 115 webkit_glue::InjectIDBKey(key, value, key_path)); |
119 Send(new UtilityHostMsg_InjectIDBKey_Finished(new_value)); | 116 Send(new UtilityHostMsg_InjectIDBKey_Finished(new_value)); |
120 ReleaseProcessIfNeeded(); | 117 ReleaseProcessIfNeeded(); |
121 } | 118 } |
122 | 119 |
123 void UtilityThreadImpl::OnBatchModeStarted() { | 120 void UtilityThreadImpl::OnBatchModeStarted() { |
124 batch_mode_ = true; | 121 batch_mode_ = true; |
125 } | 122 } |
126 | 123 |
(...skipping 28 matching lines...) Expand all Loading... |
155 webkit::WebPluginInfo plugin; | 152 webkit::WebPluginInfo plugin; |
156 if (!plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups, &plugin)) | 153 if (!plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups, &plugin)) |
157 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 154 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
158 else | 155 else |
159 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 156 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); |
160 } | 157 } |
161 | 158 |
162 ReleaseProcessIfNeeded(); | 159 ReleaseProcessIfNeeded(); |
163 } | 160 } |
164 #endif | 161 #endif |
OLD | NEW |