OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/webidbfactory_impl.h" | 5 #include "content/child/indexed_db/webidbfactory_impl.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "content/child/indexed_db/indexed_db_callbacks_impl.h" | 8 #include "content/child/indexed_db/indexed_db_callbacks_impl.h" |
9 #include "content/child/indexed_db/indexed_db_database_callbacks_impl.h" | 9 #include "content/child/indexed_db/indexed_db_database_callbacks_impl.h" |
10 #include "content/child/storage_util.h" | 10 #include "content/child/storage_util.h" |
| 11 #include "content/common/indexed_db/indexed_db_data_format_version.h" |
11 #include "ipc/ipc_sync_channel.h" | 12 #include "ipc/ipc_sync_channel.h" |
12 #include "mojo/public/cpp/bindings/strong_associated_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_associated_binding.h" |
13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 14 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/public/web/WebSerializedScriptValueVersion.h" |
15 | 17 |
16 using blink::WebIDBCallbacks; | 18 using blink::WebIDBCallbacks; |
17 using blink::WebIDBDatabase; | 19 using blink::WebIDBDatabase; |
18 using blink::WebIDBDatabaseCallbacks; | 20 using blink::WebIDBDatabaseCallbacks; |
19 using blink::WebSecurityOrigin; | 21 using blink::WebSecurityOrigin; |
20 using blink::WebString; | 22 using blink::WebString; |
21 using indexed_db::mojom::CallbacksAssociatedPtrInfo; | 23 using indexed_db::mojom::CallbacksAssociatedPtrInfo; |
22 using indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo; | 24 using indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo; |
23 using indexed_db::mojom::FactoryAssociatedPtr; | 25 using indexed_db::mojom::FactoryAssociatedPtr; |
24 | 26 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 url::Origin(origin), force_close)); | 111 url::Origin(origin), force_close)); |
110 } | 112 } |
111 | 113 |
112 WebIDBFactoryImpl::IOThreadHelper::IOThreadHelper( | 114 WebIDBFactoryImpl::IOThreadHelper::IOThreadHelper( |
113 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter) | 115 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter) |
114 : sync_message_filter_(std::move(sync_message_filter)) {} | 116 : sync_message_filter_(std::move(sync_message_filter)) {} |
115 | 117 |
116 WebIDBFactoryImpl::IOThreadHelper::~IOThreadHelper() {} | 118 WebIDBFactoryImpl::IOThreadHelper::~IOThreadHelper() {} |
117 | 119 |
118 FactoryAssociatedPtr& WebIDBFactoryImpl::IOThreadHelper::GetService() { | 120 FactoryAssociatedPtr& WebIDBFactoryImpl::IOThreadHelper::GetService() { |
119 if (!service_) | 121 if (!service_) { |
120 sync_message_filter_->GetRemoteAssociatedInterface(&service_); | 122 sync_message_filter_->GetRemoteAssociatedInterface(&service_); |
| 123 DCHECK(service_); |
| 124 auto version = blink::WebSerializedScriptValueVersion::current(); |
| 125 service_->Configure( |
| 126 IndexedDBDataFormatVersion(version.v8Version, version.blinkVersion)); |
| 127 } |
121 return service_; | 128 return service_; |
122 } | 129 } |
123 | 130 |
124 CallbacksAssociatedPtrInfo WebIDBFactoryImpl::IOThreadHelper::GetCallbacksProxy( | 131 CallbacksAssociatedPtrInfo WebIDBFactoryImpl::IOThreadHelper::GetCallbacksProxy( |
125 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) { | 132 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) { |
126 CallbacksAssociatedPtrInfo ptr_info; | 133 CallbacksAssociatedPtrInfo ptr_info; |
127 auto request = mojo::MakeRequest(&ptr_info); | 134 auto request = mojo::MakeRequest(&ptr_info); |
128 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); | 135 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); |
129 return ptr_info; | 136 return ptr_info; |
130 } | 137 } |
(...skipping 29 matching lines...) Expand all Loading... |
160 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( | 167 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( |
161 const base::string16& name, | 168 const base::string16& name, |
162 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, | 169 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, |
163 const url::Origin& origin, | 170 const url::Origin& origin, |
164 bool force_close) { | 171 bool force_close) { |
165 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, | 172 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, |
166 name, force_close); | 173 name, force_close); |
167 } | 174 } |
168 | 175 |
169 } // namespace content | 176 } // namespace content |
OLD | NEW |