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

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

Issue 1158973007: IndexedDB: Rely on bindings for enum validation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBCursor.h ('k') | Source/modules/indexeddb/IDBDatabase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return m_source->idbIndex()->objectStore(); 352 return m_source->idbIndex()->objectStore();
353 } 353 }
354 354
355 bool IDBCursor::isDeleted() const 355 bool IDBCursor::isDeleted() const
356 { 356 {
357 if (m_source->type() == IDBAny::IDBObjectStoreType) 357 if (m_source->type() == IDBAny::IDBObjectStoreType)
358 return m_source->idbObjectStore()->isDeleted(); 358 return m_source->idbObjectStore()->isDeleted();
359 return m_source->idbIndex()->isDeleted(); 359 return m_source->idbIndex()->isDeleted();
360 } 360 }
361 361
362 WebIDBCursorDirection IDBCursor::stringToDirection(const String& directionString , ExceptionState& exceptionState) 362 WebIDBCursorDirection IDBCursor::stringToDirection(const String& directionString )
363 { 363 {
364 if (directionString == IndexedDBNames::next) 364 if (directionString == IndexedDBNames::next)
365 return WebIDBCursorDirectionNext; 365 return WebIDBCursorDirectionNext;
366 if (directionString == IndexedDBNames::nextunique) 366 if (directionString == IndexedDBNames::nextunique)
367 return WebIDBCursorDirectionNextNoDuplicate; 367 return WebIDBCursorDirectionNextNoDuplicate;
368 if (directionString == IndexedDBNames::prev) 368 if (directionString == IndexedDBNames::prev)
369 return WebIDBCursorDirectionPrev; 369 return WebIDBCursorDirectionPrev;
370 if (directionString == IndexedDBNames::prevunique) 370 if (directionString == IndexedDBNames::prevunique)
371 return WebIDBCursorDirectionPrevNoDuplicate; 371 return WebIDBCursorDirectionPrevNoDuplicate;
372 372
373 exceptionState.throwTypeError("The direction provided ('" + directionString + "') is not one of 'next', 'nextunique', 'prev', or 'prevunique'."); 373 ASSERT_NOT_REACHED();
374 return WebIDBCursorDirectionNext; 374 return WebIDBCursorDirectionNext;
375 } 375 }
376 376
377 const String& IDBCursor::direction() const 377 const String& IDBCursor::direction() const
378 { 378 {
379 switch (m_direction) { 379 switch (m_direction) {
380 case WebIDBCursorDirectionNext: 380 case WebIDBCursorDirectionNext:
381 return IndexedDBNames::next; 381 return IndexedDBNames::next;
382 382
383 case WebIDBCursorDirectionNextNoDuplicate: 383 case WebIDBCursorDirectionNextNoDuplicate:
384 return IndexedDBNames::nextunique; 384 return IndexedDBNames::nextunique;
385 385
386 case WebIDBCursorDirectionPrev: 386 case WebIDBCursorDirectionPrev:
387 return IndexedDBNames::prev; 387 return IndexedDBNames::prev;
388 388
389 case WebIDBCursorDirectionPrevNoDuplicate: 389 case WebIDBCursorDirectionPrevNoDuplicate:
390 return IndexedDBNames::prevunique; 390 return IndexedDBNames::prevunique;
391 391
392 default: 392 default:
393 ASSERT_NOT_REACHED(); 393 ASSERT_NOT_REACHED();
394 return IndexedDBNames::next; 394 return IndexedDBNames::next;
395 } 395 }
396 } 396 }
397 397
398 } // namespace blink 398 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBCursor.h ('k') | Source/modules/indexeddb/IDBDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698