Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: content/browser/indexed_db/indexed_db_change_handler_impl.cc

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/indexed_db/indexed_db_change_handler_impl.h"
6
7 #include <utility>
8
9 #include "content/browser/indexed_db/indexed_db_connection.h"
10 #include "content/browser/indexed_db/indexed_db_database_error.h"
11 #include "content/browser/indexed_db/indexed_db_observer_changes.h"
12
13 namespace content {
14
15 IndexedDBChangeHandlerImpl::IndexedDBChangeHandlerImpl(
16 ::indexed_db::mojom::DatabaseObserverPtr database_observer)
17 : database_observer_(std::move(database_observer)) {}
18
19 IndexedDBChangeHandlerImpl::~IndexedDBChangeHandlerImpl() {}
20
21 void IndexedDBChangeHandlerImpl::OnForcedClose() {
22 if (!database_observer_)
23 return;
24
25 database_observer_->OnForcedClosed();
26 database_observer_ = nullptr;
27 }
28
29 void IndexedDBChangeHandlerImpl::OnVersionChange(int64_t old_version,
30 int64_t new_version) {
31 if (!database_observer_)
32 return;
33
34 database_observer_->OnVersionChange(old_version, new_version);
35 }
36
37 void IndexedDBChangeHandlerImpl::OnAbort(int64_t transaction_id,
38 const IndexedDBDatabaseError& error) {
39 if (!database_observer_)
40 return;
41
42 if (connection_)
43 connection_->FinishTransaction(transaction_id, false);
44 database_observer_->OnTransactionAborted(transaction_id, error);
45 }
46
47 void IndexedDBChangeHandlerImpl::OnComplete(int64_t transaction_id) {
48 if (!database_observer_)
49 return;
50
51 if (connection_)
52 connection_->FinishTransaction(transaction_id, false);
53 database_observer_->OnTransactionCompleted(transaction_id);
54 }
55
56 void IndexedDBChangeHandlerImpl::OnDatabaseChange(
57 int32_t ipc_database_id,
58 std::unique_ptr<IndexedDBObserverChanges> changes) {
59 // TODO(cmumford): Add observer functions to Mojo interface.
60 #if 0
61 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksChanges(
62 ipc_thread_id_, ipc_database_id,
63 IndexedDBDispatcherHost::ConvertObserverChanges(std::move(changes))));
64 #endif
65 }
66
67 void IndexedDBChangeHandlerImpl::SetConnection(
68 base::WeakPtr<IndexedDBConnection> connection) {
69 connection_ = std::move(connection);
70 }
71
72 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_change_handler_impl.h ('k') | content/browser/indexed_db/indexed_db_class_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698