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

Side by Side Diff: Source/modules/indexeddb/IDBRequest.h

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 30 matching lines...) Expand all
41 #include "modules/indexeddb/IDBAny.h" 41 #include "modules/indexeddb/IDBAny.h"
42 #include "modules/indexeddb/IDBCallbacks.h" 42 #include "modules/indexeddb/IDBCallbacks.h"
43 #include "modules/indexeddb/IDBCursor.h" 43 #include "modules/indexeddb/IDBCursor.h"
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 class ExceptionState; 47 class ExceptionState;
48 class IDBTransaction; 48 class IDBTransaction;
49 class SharedBuffer; 49 class SharedBuffer;
50 50
51 class IDBRequest : public ScriptWrappable, public IDBCallbacks, public EventTarg et, public ActiveDOMObject { 51 class IDBRequest : public ScriptWrappable, public IDBCallbacks, public EventTarg etWithInlineData, public ActiveDOMObject {
52 public: 52 public:
53 static PassRefPtr<IDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDB Any> source, IDBTransaction*); 53 static PassRefPtr<IDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDB Any> source, IDBTransaction*);
54 static PassRefPtr<IDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDB Any> source, IDBDatabaseBackendInterface::TaskType, IDBTransaction*); 54 static PassRefPtr<IDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDB Any> source, IDBDatabaseBackendInterface::TaskType, IDBTransaction*);
55 virtual ~IDBRequest(); 55 virtual ~IDBRequest();
56 56
57 PassRefPtr<IDBAny> result(ExceptionState&) const; 57 PassRefPtr<IDBAny> result(ExceptionState&) const;
58 PassRefPtr<DOMError> error(ExceptionState&) const; 58 PassRefPtr<DOMError> error(ExceptionState&) const;
59 PassRefPtr<IDBAny> source() const; 59 PassRefPtr<IDBAny> source() const;
60 PassRefPtr<IDBTransaction> transaction() const; 60 PassRefPtr<IDBTransaction> transaction() const;
61 void preventPropagation() { m_preventPropagation = true; } 61 void preventPropagation() { m_preventPropagation = true; }
(...skipping 24 matching lines...) Expand all
86 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I DBKeyPath&); 86 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I DBKeyPath&);
87 virtual void onSuccess(int64_t); 87 virtual void onSuccess(int64_t);
88 virtual void onSuccess(); 88 virtual void onSuccess();
89 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>); 89 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>);
90 90
91 // ActiveDOMObject 91 // ActiveDOMObject
92 virtual bool hasPendingActivity() const OVERRIDE; 92 virtual bool hasPendingActivity() const OVERRIDE;
93 virtual void stop() OVERRIDE; 93 virtual void stop() OVERRIDE;
94 94
95 // EventTarget 95 // EventTarget
96 virtual const AtomicString& interfaceName() const; 96 virtual const AtomicString& interfaceName() const OVERRIDE;
97 virtual ScriptExecutionContext* scriptExecutionContext() const; 97 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
98 virtual void uncaughtExceptionInEventHandler(); 98 virtual void uncaughtExceptionInEventHandler() OVERRIDE;
99 99
100 using EventTarget::dispatchEvent; 100 using EventTarget::dispatchEvent;
101 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; 101 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE;
102 102
103 void transactionDidFinishAndDispatch(); 103 void transactionDidFinishAndDispatch();
104 104
105 using IDBCallbacks::ref; 105 using IDBCallbacks::ref;
106 using IDBCallbacks::deref; 106 using IDBCallbacks::deref;
107 107
108 virtual void deref() OVERRIDE 108 virtual void deref() OVERRIDE
(...skipping 18 matching lines...) Expand all
127 127
128 RefPtr<IDBAny> m_result; 128 RefPtr<IDBAny> m_result;
129 RefPtr<DOMError> m_error; 129 RefPtr<DOMError> m_error;
130 bool m_contextStopped; 130 bool m_contextStopped;
131 RefPtr<IDBTransaction> m_transaction; 131 RefPtr<IDBTransaction> m_transaction;
132 ReadyState m_readyState; 132 ReadyState m_readyState;
133 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert. 133 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert.
134 134
135 private: 135 private:
136 // EventTarget 136 // EventTarget
137 virtual void refEventTarget() { ref(); } 137 virtual void refEventTarget() OVERRIDE { ref(); }
138 virtual void derefEventTarget() { deref(); } 138 virtual void derefEventTarget() OVERRIDE { deref(); }
139 virtual EventTargetData* eventTargetData();
140 virtual EventTargetData* ensureEventTargetData();
141 139
142 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value); 140 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value);
143 void checkForReferenceCycle(); 141 void checkForReferenceCycle();
144 142
145
146 RefPtr<IDBAny> m_source; 143 RefPtr<IDBAny> m_source;
147 const IDBDatabaseBackendInterface::TaskType m_taskType; 144 const IDBDatabaseBackendInterface::TaskType m_taskType;
148 145
149 bool m_hasPendingActivity; 146 bool m_hasPendingActivity;
150 Vector<RefPtr<Event> > m_enqueuedEvents; 147 Vector<RefPtr<Event> > m_enqueuedEvents;
151 148
152 // Only used if the result type will be a cursor. 149 // Only used if the result type will be a cursor.
153 IndexedDB::CursorType m_cursorType; 150 IndexedDB::CursorType m_cursorType;
154 IndexedDB::CursorDirection m_cursorDirection; 151 IndexedDB::CursorDirection m_cursorDirection;
155 RefPtr<IDBCursor> m_pendingCursor; 152 RefPtr<IDBCursor> m_pendingCursor;
156 RefPtr<IDBKey> m_cursorKey; 153 RefPtr<IDBKey> m_cursorKey;
157 RefPtr<IDBKey> m_cursorPrimaryKey; 154 RefPtr<IDBKey> m_cursorPrimaryKey;
158 RefPtr<SharedBuffer> m_cursorValue; 155 RefPtr<SharedBuffer> m_cursorValue;
159 bool m_didFireUpgradeNeededEvent; 156 bool m_didFireUpgradeNeededEvent;
160 bool m_preventPropagation; 157 bool m_preventPropagation;
161 158
162 EventTargetData m_eventTargetData;
163 DOMRequestState m_requestState; 159 DOMRequestState m_requestState;
164 }; 160 };
165 161
166 } // namespace WebCore 162 } // namespace WebCore
167 163
168 #endif // IDBRequest_h 164 #endif // IDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698