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

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

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Allow cpp_only to be set by the invoker. 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) 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 20 matching lines...) Expand all
31 #include "bindings/modules/v8/ToV8ForModules.h" 31 #include "bindings/modules/v8/ToV8ForModules.h"
32 #include "bindings/modules/v8/V8BindingForModules.h" 32 #include "bindings/modules/v8/V8BindingForModules.h"
33 #include "bindings/modules/v8/V8IDBRequest.h" 33 #include "bindings/modules/v8/V8IDBRequest.h"
34 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "modules/IndexedDBNames.h" 35 #include "modules/IndexedDBNames.h"
36 #include "modules/indexeddb/IDBAny.h" 36 #include "modules/indexeddb/IDBAny.h"
37 #include "modules/indexeddb/IDBDatabase.h" 37 #include "modules/indexeddb/IDBDatabase.h"
38 #include "modules/indexeddb/IDBObjectStore.h" 38 #include "modules/indexeddb/IDBObjectStore.h"
39 #include "modules/indexeddb/IDBTracing.h" 39 #include "modules/indexeddb/IDBTracing.h"
40 #include "modules/indexeddb/IDBTransaction.h" 40 #include "modules/indexeddb/IDBTransaction.h"
41 #include "modules/indexeddb/WebIDBCallbacksImpl.h"
42 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" 41 #include "public/platform/modules/indexeddb/WebIDBDatabase.h"
43 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" 42 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h"
44 #include <limits> 43 #include <limits>
45 #include <memory> 44 #include <memory>
46 45
47 using blink::WebIDBCursor; 46 using blink::WebIDBCursor;
48 using blink::WebIDBDatabase; 47 using blink::WebIDBDatabase;
49 48
50 namespace blink { 49 namespace blink {
51 50
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceD eletedErrorMessage); 141 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceD eletedErrorMessage);
143 return; 142 return;
144 } 143 }
145 if (!m_gotValue) { 144 if (!m_gotValue) {
146 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValue ErrorMessage); 145 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValue ErrorMessage);
147 return; 146 return;
148 } 147 }
149 148
150 m_request->setPendingCursor(this); 149 m_request->setPendingCursor(this);
151 m_gotValue = false; 150 m_gotValue = false;
152 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).release()); 151 m_backend->advance(count, m_request->createWebCallbacks().release());
153 } 152 }
154 153
155 void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& ke yValue, ExceptionState& exceptionState) 154 void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& ke yValue, ExceptionState& exceptionState)
156 { 155 {
157 IDB_TRACE("IDBCursor::continue"); 156 IDB_TRACE("IDBCursor::continue");
158 157
159 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 158 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
160 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 159 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
161 return; 160 return;
162 } 161 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 exceptionState.throwDOMException(DataError, "The parameter is gr eater than or equal to this cursor's position."); 255 exceptionState.throwDOMException(DataError, "The parameter is gr eater than or equal to this cursor's position.");
257 return; 256 return;
258 } 257 }
259 } 258 }
260 } 259 }
261 260
262 // FIXME: We're not using the context from when continue was called, which m eans the callback 261 // FIXME: We're not using the context from when continue was called, which m eans the callback
263 // will be on the original context openCursor was called on. Is this right? 262 // will be on the original context openCursor was called on. Is this right?
264 m_request->setPendingCursor(this); 263 m_request->setPendingCursor(this);
265 m_gotValue = false; 264 m_gotValue = false;
266 m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_r equest).release()); 265 m_backend->continueFunction(key, primaryKey, m_request->createWebCallbacks() .release());
267 } 266 }
268 267
269 IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& exceptionState) 268 IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& exceptionState)
270 { 269 {
271 IDB_TRACE("IDBCursor::delete"); 270 IDB_TRACE("IDBCursor::delete");
272 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 271 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
273 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 272 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
274 return nullptr; 273 return nullptr;
275 } 274 }
276 if (!m_transaction->isActive()) { 275 if (!m_transaction->isActive()) {
(...skipping 18 matching lines...) Expand all
295 } 294 }
296 if (!m_transaction->backendDB()) { 295 if (!m_transaction->backendDB()) {
297 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage); 296 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
298 return nullptr; 297 return nullptr;
299 } 298 }
300 299
301 IDBKeyRange* keyRange = IDBKeyRange::only(m_primaryKey, exceptionState); 300 IDBKeyRange* keyRange = IDBKeyRange::only(m_primaryKey, exceptionState);
302 DCHECK(!exceptionState.hadException()); 301 DCHECK(!exceptionState.hadException());
303 302
304 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); 303 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
305 m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObject Store()->id(), keyRange, WebIDBCallbacksImpl::create(request).release()); 304 m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObject Store()->id(), keyRange, request->createWebCallbacks().release());
306 return request; 305 return request;
307 } 306 }
308 307
309 void IDBCursor::postSuccessHandlerCallback() 308 void IDBCursor::postSuccessHandlerCallback()
310 { 309 {
311 if (m_backend) 310 if (m_backend)
312 m_backend->postSuccessHandlerCallback(); 311 m_backend->postSuccessHandlerCallback();
313 } 312 }
314 313
315 void IDBCursor::close() 314 void IDBCursor::close()
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 case WebIDBCursorDirectionPrevNoDuplicate: 418 case WebIDBCursorDirectionPrevNoDuplicate:
420 return IndexedDBNames::prevunique; 419 return IndexedDBNames::prevunique;
421 420
422 default: 421 default:
423 NOTREACHED(); 422 NOTREACHED();
424 return IndexedDBNames::next; 423 return IndexedDBNames::next;
425 } 424 }
426 } 425 }
427 426
428 } // namespace blink 427 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698