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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unobserve functionality Created 4 years, 6 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/indexeddb/IDBObserver.h" 5 #include "modules/indexeddb/IDBObserver.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
9 #include "bindings/modules/v8/ToV8ForModules.h" 9 #include "bindings/modules/v8/ToV8ForModules.h"
10 #include "bindings/modules/v8/V8BindingForModules.h" 10 #include "bindings/modules/v8/V8BindingForModules.h"
(...skipping 27 matching lines...) Expand all
38 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); 38 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
39 return; 39 return;
40 } 40 }
41 if (!database->backend()) { 41 if (!database->backend()) {
42 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage); 42 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
43 return; 43 return;
44 } 44 }
45 database->backend()->observe(this, transaction->id()); 45 database->backend()->observe(this, transaction->id());
46 } 46 }
47 47
48 void IDBObserver::unobserve(IDBDatabase* database, ExceptionState& exceptionStat e)
49 {
50 if (!database->backend()) {
51 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
52 return;
53 }
54 database->backend()->unobserve(this);
55 }
56
48 DEFINE_TRACE(IDBObserver) 57 DEFINE_TRACE(IDBObserver)
49 { 58 {
50 visitor->trace(m_callback); 59 visitor->trace(m_callback);
51 } 60 }
52 61
53 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698