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

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

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Require explicit wrapping when discarding map keys. 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return; 166 return;
168 } 167 }
169 if (!m_gotValue) { 168 if (!m_gotValue) {
170 exceptionState.throwDOMException(InvalidStateError, 169 exceptionState.throwDOMException(InvalidStateError,
171 IDBDatabase::noValueErrorMessage); 170 IDBDatabase::noValueErrorMessage);
172 return; 171 return;
173 } 172 }
174 173
175 m_request->setPendingCursor(this); 174 m_request->setPendingCursor(this);
176 m_gotValue = false; 175 m_gotValue = false;
177 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).release()); 176 m_backend->advance(count, m_request->createWebCallbacks().release());
178 } 177 }
179 178
180 void IDBCursor::continueFunction(ScriptState* scriptState, 179 void IDBCursor::continueFunction(ScriptState* scriptState,
181 const ScriptValue& keyValue, 180 const ScriptValue& keyValue,
182 ExceptionState& exceptionState) { 181 ExceptionState& exceptionState) {
183 IDB_TRACE("IDBCursor::continue"); 182 IDB_TRACE("IDBCursor::continue");
184 183
185 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 184 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
186 exceptionState.throwDOMException( 185 exceptionState.throwDOMException(
187 TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); 186 TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 315 }
317 } 316 }
318 } 317 }
319 318
320 // FIXME: We're not using the context from when continue was called, which 319 // FIXME: We're not using the context from when continue was called, which
321 // means the callback will be on the original context openCursor was called 320 // means the callback will be on the original context openCursor was called
322 // on. Is this right? 321 // on. Is this right?
323 m_request->setPendingCursor(this); 322 m_request->setPendingCursor(this);
324 m_gotValue = false; 323 m_gotValue = false;
325 m_backend->continueFunction(key, primaryKey, 324 m_backend->continueFunction(key, primaryKey,
326 WebIDBCallbacksImpl::create(m_request).release()); 325 m_request->createWebCallbacks().release());
327 } 326 }
328 327
329 IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, 328 IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState,
330 ExceptionState& exceptionState) { 329 ExceptionState& exceptionState) {
331 IDB_TRACE("IDBCursor::delete"); 330 IDB_TRACE("IDBCursor::delete");
332 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 331 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
333 exceptionState.throwDOMException( 332 exceptionState.throwDOMException(
334 TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); 333 TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
335 return nullptr; 334 return nullptr;
336 } 335 }
(...skipping 29 matching lines...) Expand all
366 return nullptr; 365 return nullptr;
367 } 366 }
368 367
369 IDBKeyRange* keyRange = IDBKeyRange::only(m_primaryKey, exceptionState); 368 IDBKeyRange* keyRange = IDBKeyRange::only(m_primaryKey, exceptionState);
370 DCHECK(!exceptionState.hadException()); 369 DCHECK(!exceptionState.hadException());
371 370
372 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), 371 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
373 m_transaction.get()); 372 m_transaction.get());
374 m_transaction->backendDB()->deleteRange( 373 m_transaction->backendDB()->deleteRange(
375 m_transaction->id(), effectiveObjectStore()->id(), keyRange, 374 m_transaction->id(), effectiveObjectStore()->id(), keyRange,
376 WebIDBCallbacksImpl::create(request).release()); 375 request->createWebCallbacks().release());
377 return request; 376 return request;
378 } 377 }
379 378
380 void IDBCursor::postSuccessHandlerCallback() { 379 void IDBCursor::postSuccessHandlerCallback() {
381 if (m_backend) 380 if (m_backend)
382 m_backend->postSuccessHandlerCallback(); 381 m_backend->postSuccessHandlerCallback();
383 } 382 }
384 383
385 void IDBCursor::close() { 384 void IDBCursor::close() {
386 m_value.clear(); 385 m_value.clear();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 case WebIDBCursorDirectionPrevNoDuplicate: 483 case WebIDBCursorDirectionPrevNoDuplicate:
485 return IndexedDBNames::prevunique; 484 return IndexedDBNames::prevunique;
486 485
487 default: 486 default:
488 NOTREACHED(); 487 NOTREACHED();
489 return IndexedDBNames::next; 488 return IndexedDBNames::next;
490 } 489 }
491 } 490 }
492 491
493 } // namespace blink 492 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698