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

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

Issue 22893058: IndexedDB: Replace IDL operation overloading with ScriptValue handling (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove assert, per review feedback Created 7 years, 3 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/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // Implement the IDBObjectStore IDL 58 // Implement the IDBObjectStore IDL
59 int64_t id() const { return m_metadata.id; } 59 int64_t id() const { return m_metadata.id; }
60 const String& name() const { return m_metadata.name; } 60 const String& name() const { return m_metadata.name; }
61 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key Path); } 61 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key Path); }
62 const IDBKeyPath& keyPath() const { return m_metadata.keyPath; } 62 const IDBKeyPath& keyPath() const { return m_metadata.keyPath; }
63 PassRefPtr<DOMStringList> indexNames() const; 63 PassRefPtr<DOMStringList> indexNames() const;
64 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } 64 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
65 bool autoIncrement() const { return m_metadata.autoIncrement; } 65 bool autoIncrement() const { return m_metadata.autoIncrement; }
66 66
67 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt r<IDBKeyRange> range, const String& direction, ExceptionState& es) { return open Cursor(context, range, direction, IDBDatabaseBackendInterface::NormalTask, es); } 67 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue & range, const String& direction, ExceptionState&);
68 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue & key, const String& direction, ExceptionState&);
69 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key, ExceptionState&); 68 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key, ExceptionState&);
70 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionState&);
71 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&); 69 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&);
72 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&); 70 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&);
73 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID BKeyRange>, ExceptionState&);
74 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, const ScriptV alue& key, ExceptionState&); 71 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, const ScriptV alue& key, ExceptionState&);
75 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionState&); 72 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionState&);
76 73
77 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const String& keyPath, const Dictionary& options, ExceptionState& es) { return createIndex(context, name, IDBKeyPath(keyPath), options, es); } 74 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const String& keyPath, const Dictionary& options, ExceptionState& es) { return createIndex(context, name, IDBKeyPath(keyPath), options, es); }
78 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionSta te& es) { return createIndex(context, name, IDBKeyPath(keyPath), options, es); } 75 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionSta te& es) { return createIndex(context, name, IDBKeyPath(keyPath), options, es); }
79 PassRefPtr<IDBIndex> index(const String& name, ExceptionState&); 76 PassRefPtr<IDBIndex> index(const String& name, ExceptionState&);
80 void deleteIndex(const String& name, ExceptionState&); 77 void deleteIndex(const String& name, ExceptionState&);
81 78
82 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange >, ExceptionState&); 79 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& ran ge, ExceptionState&);
83 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key , ExceptionState&);
84 80
85 // Used by IDBCursor::update(): 81 // Used by IDBCursor::update():
86 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionState&) ; 82 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionState&) ;
87 83
84 // Used internally and by InspectorIndexedDBAgent:
85 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey Range>, IndexedDB::CursorDirection, IDBDatabaseBackendInterface::TaskType = IDBD atabaseBackendInterface::NormalTask);
86
88 void markDeleted() { m_deleted = true; } 87 void markDeleted() { m_deleted = true; }
89 bool isDeleted() const { return m_deleted; } 88 bool isDeleted() const { return m_deleted; }
90 void transactionFinished(); 89 void transactionFinished();
91 90
92 IDBObjectStoreMetadata metadata() const { return m_metadata; } 91 IDBObjectStoreMetadata metadata() const { return m_metadata; }
93 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; } 92 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; }
94 93
95 typedef Vector<RefPtr<IDBKey> > IndexKeys; 94 typedef Vector<RefPtr<IDBKey> > IndexKeys;
96 typedef HashMap<String, IndexKeys> IndexKeyMap; 95 typedef HashMap<String, IndexKeys> IndexKeyMap;
97 96
98 IDBDatabaseBackendInterface* backendDB() const; 97 IDBDatabaseBackendInterface* backendDB() const;
99 98
100 private: 99 private:
101 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); 100 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*);
102 101
103 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey Range>, const String& direction, IDBDatabaseBackendInterface::TaskType, Exceptio nState&);
104 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, const Dictionary&, ExceptionState&); 102 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, const Dictionary&, ExceptionState&);
105 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&); 103 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&);
106 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionSta te&); 104 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionSta te&);
107 105
108 int64_t findIndexId(const String& name) const; 106 int64_t findIndexId(const String& name) const;
109 bool containsIndex(const String& name) const 107 bool containsIndex(const String& name) const
110 { 108 {
111 return findIndexId(name) != IDBIndexMetadata::InvalidId; 109 return findIndexId(name) != IDBIndexMetadata::InvalidId;
112 } 110 }
113 111
114 IDBObjectStoreMetadata m_metadata; 112 IDBObjectStoreMetadata m_metadata;
115 RefPtr<IDBTransaction> m_transaction; 113 RefPtr<IDBTransaction> m_transaction;
116 bool m_deleted; 114 bool m_deleted;
117 115
118 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; 116 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap;
119 IDBIndexMap m_indexMap; 117 IDBIndexMap m_indexMap;
120 }; 118 };
121 119
122 } // namespace WebCore 120 } // namespace WebCore
123 121
124 #endif // IDBObjectStore_h 122 #endif // IDBObjectStore_h
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698