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

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

Issue 2870803002: Rename IDBRequest::On* callbacks to IDBRequest::Enqueue*. (Closed)
Patch Set: De-virtualized one more callback. Created 3 years, 7 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) 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 std::unique_ptr<WebIDBCallbacks> CreateWebCallbacks(); 91 std::unique_ptr<WebIDBCallbacks> CreateWebCallbacks();
92 void WebCallbacksDestroyed(); 92 void WebCallbacksDestroyed();
93 93
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
95 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
96 96
97 void SetCursorDetails(IndexedDB::CursorType, WebIDBCursorDirection); 97 void SetCursorDetails(IndexedDB::CursorType, WebIDBCursorDirection);
98 void SetPendingCursor(IDBCursor*); 98 void SetPendingCursor(IDBCursor*);
99 void Abort(); 99 void Abort();
100 100
101 virtual void OnError(DOMException*); 101 void EnqueueResponse(DOMException*);
102 virtual void OnSuccess(const Vector<String>&); 102 void EnqueueResponse(std::unique_ptr<WebIDBCursor>,
103 virtual void OnSuccess(std::unique_ptr<WebIDBCursor>, 103 IDBKey*,
104 IDBKey*, 104 IDBKey* primary_key,
105 IDBKey* primary_key, 105 PassRefPtr<IDBValue>);
106 PassRefPtr<IDBValue>); 106 void EnqueueResponse(IDBKey*);
107 virtual void OnSuccess(IDBKey*); 107 void EnqueueResponse(PassRefPtr<IDBValue>);
108 virtual void OnSuccess(PassRefPtr<IDBValue>); 108 void EnqueueResponse(const Vector<RefPtr<IDBValue>>&);
109 virtual void OnSuccess(const Vector<RefPtr<IDBValue>>&); 109 void EnqueueResponse();
110 virtual void OnSuccess(int64_t); 110 void EnqueueResponse(IDBKey*, IDBKey* primary_key, PassRefPtr<IDBValue>);
111 virtual void OnSuccess(); 111
112 virtual void OnSuccess(IDBKey*, IDBKey* primary_key, PassRefPtr<IDBValue>); 112 // Only used in webkitGetDatabaseNames(), which is deprecated and hopefully
113 // going away soon.
114 void EnqueueResponse(const Vector<String>&);
115
116 // Overridden by IDBOpenDBRequest.
117 virtual void EnqueueResponse(int64_t);
113 118
114 // Only IDBOpenDBRequest instances should receive these: 119 // Only IDBOpenDBRequest instances should receive these:
115 virtual void OnBlocked(int64_t old_version) { NOTREACHED(); } 120 virtual void EnqueueBlocked(int64_t old_version) { NOTREACHED(); }
116 virtual void OnUpgradeNeeded(int64_t old_version, 121 virtual void EnqueueUpgradeNeeded(int64_t old_version,
117 std::unique_ptr<WebIDBDatabase>, 122 std::unique_ptr<WebIDBDatabase>,
118 const IDBDatabaseMetadata&, 123 const IDBDatabaseMetadata&,
119 WebIDBDataLoss, 124 WebIDBDataLoss,
120 String data_loss_message) { 125 String data_loss_message) {
121 NOTREACHED(); 126 NOTREACHED();
122 } 127 }
123 virtual void OnSuccess(std::unique_ptr<WebIDBDatabase>, 128 virtual void EnqueueResponse(std::unique_ptr<WebIDBDatabase>,
124 const IDBDatabaseMetadata&) { 129 const IDBDatabaseMetadata&) {
125 NOTREACHED(); 130 NOTREACHED();
126 } 131 }
127 132
128 // ScriptWrappable 133 // ScriptWrappable
129 bool HasPendingActivity() const final; 134 bool HasPendingActivity() const final;
130 135
131 // SuspendableObject 136 // SuspendableObject
132 void ContextDestroyed(ExecutionContext*) override; 137 void ContextDestroyed(ExecutionContext*) override;
133 138
134 // EventTarget 139 // EventTarget
(...skipping 11 matching lines...) Expand all
146 void StorePutOperationBlobs( 151 void StorePutOperationBlobs(
147 HashMap<String, RefPtr<BlobDataHandle>> blob_handles) { 152 HashMap<String, RefPtr<BlobDataHandle>> blob_handles) {
148 transit_blob_handles_ = std::move(blob_handles); 153 transit_blob_handles_ = std::move(blob_handles);
149 } 154 }
150 155
151 protected: 156 protected:
152 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*); 157 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*);
153 void EnqueueEvent(Event*); 158 void EnqueueEvent(Event*);
154 void DequeueEvent(Event*); 159 void DequeueEvent(Event*);
155 virtual bool ShouldEnqueueEvent() const; 160 virtual bool ShouldEnqueueEvent() const;
156 void OnSuccessInternal(IDBAny*); 161 void EnqueueResultInternal(IDBAny*);
157 void SetResult(IDBAny*); 162 void SetResult(IDBAny*);
158 163
159 // EventTarget 164 // EventTarget
160 DispatchEventResult DispatchEventInternal(Event*) override; 165 DispatchEventResult DispatchEventInternal(Event*) override;
161 166
162 Member<IDBTransaction> transaction_; 167 Member<IDBTransaction> transaction_;
163 ReadyState ready_state_ = PENDING; 168 ReadyState ready_state_ = PENDING;
164 bool request_aborted_ = false; // May be aborted by transaction then receive 169 bool request_aborted_ = false; // May be aborted by transaction then receive
165 // async onsuccess; ignore vs. assert. 170 // async onsuccess; ignore vs. assert.
166 // Maintain the isolate so that all externally allocated memory can be 171 // Maintain the isolate so that all externally allocated memory can be
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool did_throw_in_event_handler_ = false; 214 bool did_throw_in_event_handler_ = false;
210 215
211 // Pointer back to the WebIDBCallbacks that holds a persistent reference to 216 // Pointer back to the WebIDBCallbacks that holds a persistent reference to
212 // this object. 217 // this object.
213 WebIDBCallbacks* web_callbacks_ = nullptr; 218 WebIDBCallbacks* web_callbacks_ = nullptr;
214 }; 219 };
215 220
216 } // namespace blink 221 } // namespace blink
217 222
218 #endif // IDBRequest_h 223 #endif // IDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698