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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Address last nits and fix leaks in unit tests. Created 4 years, 2 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
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 23 matching lines...) Expand all
34 // static 34 // static
35 std::unique_ptr<WebIDBDatabaseCallbacksImpl> 35 std::unique_ptr<WebIDBDatabaseCallbacksImpl>
36 WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) { 36 WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) {
37 return wrapUnique(new WebIDBDatabaseCallbacksImpl(callbacks)); 37 return wrapUnique(new WebIDBDatabaseCallbacksImpl(callbacks));
38 } 38 }
39 39
40 WebIDBDatabaseCallbacksImpl::WebIDBDatabaseCallbacksImpl( 40 WebIDBDatabaseCallbacksImpl::WebIDBDatabaseCallbacksImpl(
41 IDBDatabaseCallbacks* callbacks) 41 IDBDatabaseCallbacks* callbacks)
42 : m_callbacks(callbacks) {} 42 : m_callbacks(callbacks) {}
43 43
44 WebIDBDatabaseCallbacksImpl::~WebIDBDatabaseCallbacksImpl() {} 44 WebIDBDatabaseCallbacksImpl::~WebIDBDatabaseCallbacksImpl() {
45 if (m_callbacks)
46 m_callbacks->webCallbacksDestroyed();
47 }
45 48
46 void WebIDBDatabaseCallbacksImpl::onForcedClose() { 49 void WebIDBDatabaseCallbacksImpl::onForcedClose() {
47 m_callbacks->onForcedClose(); 50 if (m_callbacks)
51 m_callbacks->onForcedClose();
48 } 52 }
49 53
50 void WebIDBDatabaseCallbacksImpl::onVersionChange(long long oldVersion, 54 void WebIDBDatabaseCallbacksImpl::onVersionChange(long long oldVersion,
51 long long newVersion) { 55 long long newVersion) {
52 m_callbacks->onVersionChange(oldVersion, newVersion); 56 if (m_callbacks)
57 m_callbacks->onVersionChange(oldVersion, newVersion);
53 } 58 }
54 59
55 void WebIDBDatabaseCallbacksImpl::onAbort(long long transactionId, 60 void WebIDBDatabaseCallbacksImpl::onAbort(long long transactionId,
56 const WebIDBDatabaseError& error) { 61 const WebIDBDatabaseError& error) {
57 m_callbacks->onAbort(transactionId, 62 if (m_callbacks) {
58 DOMException::create(error.code(), error.message())); 63 m_callbacks->onAbort(transactionId,
64 DOMException::create(error.code(), error.message()));
65 }
59 } 66 }
60 67
61 void WebIDBDatabaseCallbacksImpl::onComplete(long long transactionId) { 68 void WebIDBDatabaseCallbacksImpl::onComplete(long long transactionId) {
62 m_callbacks->onComplete(transactionId); 69 if (m_callbacks)
70 m_callbacks->onComplete(transactionId);
71 }
72
73 void WebIDBDatabaseCallbacksImpl::detach() {
74 m_callbacks.clear();
63 } 75 }
64 76
65 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698