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 "content/child/child_thread_impl.h" | 7 #include "content/child/child_thread_impl.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 thread_safe_sender_(std::move(thread_safe_sender)), | 65 thread_safe_sender_(std::move(thread_safe_sender)), |
66 io_runner_(std::move(io_runner)) {} | 66 io_runner_(std::move(io_runner)) {} |
67 | 67 |
68 WebIDBFactoryImpl::~WebIDBFactoryImpl() { | 68 WebIDBFactoryImpl::~WebIDBFactoryImpl() { |
69 io_runner_->DeleteSoon(FROM_HERE, io_helper_); | 69 io_runner_->DeleteSoon(FROM_HERE, io_helper_); |
70 } | 70 } |
71 | 71 |
72 void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks, | 72 void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks, |
73 const WebSecurityOrigin& origin) { | 73 const WebSecurityOrigin& origin) { |
74 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( | 74 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( |
75 base::WrapUnique(callbacks), thread_safe_sender_); | 75 base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction, |
| 76 io_runner_, thread_safe_sender_); |
76 io_runner_->PostTask(FROM_HERE, base::Bind(&IOThreadHelper::GetDatabaseNames, | 77 io_runner_->PostTask(FROM_HERE, base::Bind(&IOThreadHelper::GetDatabaseNames, |
77 base::Unretained(io_helper_), | 78 base::Unretained(io_helper_), |
78 base::Passed(&callbacks_impl), | 79 base::Passed(&callbacks_impl), |
79 url::Origin(origin))); | 80 url::Origin(origin))); |
80 } | 81 } |
81 | 82 |
82 void WebIDBFactoryImpl::open(const WebString& name, | 83 void WebIDBFactoryImpl::open(const WebString& name, |
83 long long version, | 84 long long version, |
84 long long transaction_id, | 85 long long transaction_id, |
85 WebIDBCallbacks* callbacks, | 86 WebIDBCallbacks* callbacks, |
86 WebIDBDatabaseCallbacks* database_callbacks, | 87 WebIDBDatabaseCallbacks* database_callbacks, |
87 const WebSecurityOrigin& origin) { | 88 const WebSecurityOrigin& origin) { |
88 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( | 89 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( |
89 base::WrapUnique(callbacks), thread_safe_sender_); | 90 base::WrapUnique(callbacks), transaction_id, io_runner_, |
| 91 thread_safe_sender_); |
90 auto database_callbacks_impl = | 92 auto database_callbacks_impl = |
91 base::MakeUnique<IndexedDBDatabaseCallbacksImpl>( | 93 base::MakeUnique<IndexedDBDatabaseCallbacksImpl>( |
92 base::WrapUnique(database_callbacks), thread_safe_sender_); | 94 base::WrapUnique(database_callbacks), thread_safe_sender_); |
93 io_runner_->PostTask( | 95 io_runner_->PostTask( |
94 FROM_HERE, | 96 FROM_HERE, |
95 base::Bind(&IOThreadHelper::Open, base::Unretained(io_helper_), | 97 base::Bind(&IOThreadHelper::Open, base::Unretained(io_helper_), |
96 WorkerThread::GetCurrentId(), base::string16(name), version, | 98 WorkerThread::GetCurrentId(), base::string16(name), version, |
97 transaction_id, base::Passed(&callbacks_impl), | 99 transaction_id, base::Passed(&callbacks_impl), |
98 base::Passed(&database_callbacks_impl), url::Origin(origin))); | 100 base::Passed(&database_callbacks_impl), url::Origin(origin))); |
99 } | 101 } |
100 | 102 |
101 void WebIDBFactoryImpl::deleteDatabase(const WebString& name, | 103 void WebIDBFactoryImpl::deleteDatabase(const WebString& name, |
102 WebIDBCallbacks* callbacks, | 104 WebIDBCallbacks* callbacks, |
103 const WebSecurityOrigin& origin) { | 105 const WebSecurityOrigin& origin) { |
104 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( | 106 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( |
105 base::WrapUnique(callbacks), thread_safe_sender_); | 107 base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction, |
| 108 io_runner_, thread_safe_sender_); |
106 io_runner_->PostTask( | 109 io_runner_->PostTask( |
107 FROM_HERE, | 110 FROM_HERE, |
108 base::Bind(&IOThreadHelper::DeleteDatabase, base::Unretained(io_helper_), | 111 base::Bind(&IOThreadHelper::DeleteDatabase, base::Unretained(io_helper_), |
109 base::string16(name), base::Passed(&callbacks_impl), | 112 base::string16(name), base::Passed(&callbacks_impl), |
110 url::Origin(origin))); | 113 url::Origin(origin))); |
111 } | 114 } |
112 | 115 |
113 WebIDBFactoryImpl::IOThreadHelper::IOThreadHelper( | 116 WebIDBFactoryImpl::IOThreadHelper::IOThreadHelper( |
114 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter) | 117 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter) |
115 : sync_message_filter_(std::move(sync_message_filter)) {} | 118 : sync_message_filter_(std::move(sync_message_filter)) {} |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 168 |
166 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( | 169 void WebIDBFactoryImpl::IOThreadHelper::DeleteDatabase( |
167 const base::string16& name, | 170 const base::string16& name, |
168 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, | 171 std::unique_ptr<IndexedDBCallbacksImpl> callbacks, |
169 const url::Origin& origin) { | 172 const url::Origin& origin) { |
170 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, | 173 GetService()->DeleteDatabase(GetCallbacksProxy(std::move(callbacks)), origin, |
171 name); | 174 name); |
172 } | 175 } |
173 | 176 |
174 } // namespace content | 177 } // namespace content |
OLD | NEW |