| 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" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 FactoryAssociatedPtr& WebIDBFactoryImpl::IOThreadHelper::GetService() { | 118 FactoryAssociatedPtr& WebIDBFactoryImpl::IOThreadHelper::GetService() { |
| 119 if (!service_) | 119 if (!service_) |
| 120 sync_message_filter_->GetRemoteAssociatedInterface(&service_); | 120 sync_message_filter_->GetRemoteAssociatedInterface(&service_); |
| 121 return service_; | 121 return service_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 CallbacksAssociatedPtrInfo WebIDBFactoryImpl::IOThreadHelper::GetCallbacksProxy( | 124 CallbacksAssociatedPtrInfo WebIDBFactoryImpl::IOThreadHelper::GetCallbacksProxy( |
| 125 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) { | 125 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) { |
| 126 CallbacksAssociatedPtrInfo ptr_info; | 126 CallbacksAssociatedPtrInfo ptr_info; |
| 127 indexed_db::mojom::CallbacksAssociatedRequest request; | 127 auto request = mojo::MakeRequest(&ptr_info); |
| 128 GetService().associated_group()->CreateAssociatedInterface( | |
| 129 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request); | |
| 130 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); | 128 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); |
| 131 return ptr_info; | 129 return ptr_info; |
| 132 } | 130 } |
| 133 | 131 |
| 134 DatabaseCallbacksAssociatedPtrInfo | 132 DatabaseCallbacksAssociatedPtrInfo |
| 135 WebIDBFactoryImpl::IOThreadHelper::GetDatabaseCallbacksProxy( | 133 WebIDBFactoryImpl::IOThreadHelper::GetDatabaseCallbacksProxy( |
| 136 std::unique_ptr<IndexedDBDatabaseCallbacksImpl> callbacks) { | 134 std::unique_ptr<IndexedDBDatabaseCallbacksImpl> callbacks) { |
| 137 DatabaseCallbacksAssociatedPtrInfo ptr_info; | 135 DatabaseCallbacksAssociatedPtrInfo ptr_info; |
| 138 indexed_db::mojom::DatabaseCallbacksAssociatedRequest request; | 136 auto request = mojo::MakeRequest(&ptr_info); |
| 139 GetService().associated_group()->CreateAssociatedInterface( | |
| 140 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request); | |
| 141 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); | 137 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); |
| 142 return ptr_info; | 138 return ptr_info; |
| 143 } | 139 } |
| 144 | 140 |
| 145 void WebIDBFactoryImpl::IOThreadHelper::GetDatabaseNames( | 141 void WebIDBFactoryImpl::IOThreadHelper::GetDatabaseNames( |
| 146 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, | 142 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, |
| 147 const url::Origin& origin) { | 143 const url::Origin& origin) { |
| 148 GetService()->GetDatabaseNames(GetCallbacksProxy(std::move(callbacks)), | 144 GetService()->GetDatabaseNames(GetCallbacksProxy(std::move(callbacks)), |
| 149 origin); | 145 origin); |
| 150 } | 146 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 164 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( | 160 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( |
| 165 const base::string16& name, | 161 const base::string16& name, |
| 166 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, | 162 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, |
| 167 const url::Origin& origin, | 163 const url::Origin& origin, |
| 168 bool force_close) { | 164 bool force_close) { |
| 169 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, | 165 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, |
| 170 name, force_close); | 166 name, force_close); |
| 171 } | 167 } |
| 172 | 168 |
| 173 } // namespace content | 169 } // namespace content |
| OLD | NEW |