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

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

Issue 14297012: IndexedDB: Use [Default] in IDLs to reduce overloads in implementations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 8 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.idl ('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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // Implement the IDBObjectStore IDL 57 // Implement the IDBObjectStore IDL
58 int64_t id() const { return m_metadata.id; } 58 int64_t id() const { return m_metadata.id; }
59 const String name() const { return m_metadata.name; } 59 const String name() const { return m_metadata.name; }
60 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key Path); } 60 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key Path); }
61 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } 61 const IDBKeyPath keyPath() const { return m_metadata.keyPath; }
62 PassRefPtr<DOMStringList> indexNames() const; 62 PassRefPtr<DOMStringList> indexNames() const;
63 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } 63 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
64 bool autoIncrement() const { return m_metadata.autoIncrement; } 64 bool autoIncrement() const { return m_metadata.autoIncrement; }
65 65
66 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, ExceptionCode&);
67 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, ExceptionCode&);
68 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, Exception Code& ec) { return openCursor(context, static_cast<IDBKeyRange*>(0), ec); }
69 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt r<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRang e, IDBCursor::directionNext(), ec); }
70 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, const Scr iptValue& key, ExceptionCode& ec) { return openCursor(context, key, IDBCursor::d irectionNext(), ec); }
71 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt r<IDBKeyRange> range, const String& direction, ExceptionCode& ec) { return openC ursor(context, range, direction, IDBDatabaseBackendInterface::NormalTask, ec); } 66 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt r<IDBKeyRange> range, const String& direction, ExceptionCode& ec) { return openC ursor(context, range, direction, IDBDatabaseBackendInterface::NormalTask, ec); }
72 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey Range>, const String& direction, IDBDatabaseBackendInterface::TaskType, Exceptio nCode&);
73 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue & key, const String& direction, ExceptionCode&); 67 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue & key, const String& direction, ExceptionCode&);
74
75 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key, ExceptionCode&); 68 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key, ExceptionCode&);
76 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&); 69 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
77 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionCode&); 70 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionCode&);
78 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionCode&); 71 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionCode&);
79 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID BKeyRange>, ExceptionCode&); 72 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID BKeyRange>, ExceptionCode&);
80 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, const ScriptV alue& key, ExceptionCode&); 73 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, const ScriptV alue& key, ExceptionCode&);
81 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&); 74 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&);
82 75
83 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } 76 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); }
84 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionCod e& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } 77 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionCod e& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); }
85 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, const Dictionary&, ExceptionCode&);
86 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCode&);
87
88 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&); 78 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&);
89 void deleteIndex(const String& name, ExceptionCode&); 79 void deleteIndex(const String& name, ExceptionCode&);
90 80
91 PassRefPtr<IDBRequest> count(ScriptExecutionContext* context, ExceptionCode& ec) { return count(context, static_cast<IDBKeyRange*>(0), ec); }
92 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange >, ExceptionCode&); 81 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange >, ExceptionCode&);
93 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key , ExceptionCode&); 82 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key , ExceptionCode&);
94 83
95 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionCod e&); 84 // Used by IDBCursor::update():
96 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&); 85 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
86
97 void markDeleted() { m_deleted = true; } 87 void markDeleted() { m_deleted = true; }
98 void transactionFinished(); 88 void transactionFinished();
99 89
100 IDBObjectStoreMetadata metadata() const { return m_metadata; } 90 IDBObjectStoreMetadata metadata() const { return m_metadata; }
101 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; } 91 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; }
102 92
103 typedef Vector<RefPtr<IDBKey> > IndexKeys; 93 typedef Vector<RefPtr<IDBKey> > IndexKeys;
104 typedef HashMap<String, IndexKeys> IndexKeyMap; 94 typedef HashMap<String, IndexKeys> IndexKeyMap;
105 95
106 IDBDatabaseBackendInterface* backendDB() const; 96 IDBDatabaseBackendInterface* backendDB() const;
107 97
108 private: 98 private:
109 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); 99 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*);
110 100
101 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey Range>, const String& direction, IDBDatabaseBackendInterface::TaskType, Exceptio nCode&);
102 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, const Dictionary&, ExceptionCode&);
103 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name , const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCode&);
104 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr< IDBAny> source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionCod e&);
105
111 int64_t findIndexId(const String& name) const; 106 int64_t findIndexId(const String& name) const;
112 bool containsIndex(const String& name) const 107 bool containsIndex(const String& name) const
113 { 108 {
114 return findIndexId(name) != IDBIndexMetadata::InvalidId; 109 return findIndexId(name) != IDBIndexMetadata::InvalidId;
115 } 110 }
116 111
117 IDBObjectStoreMetadata m_metadata; 112 IDBObjectStoreMetadata m_metadata;
118 RefPtr<IDBTransaction> m_transaction; 113 RefPtr<IDBTransaction> m_transaction;
119 bool m_deleted; 114 bool m_deleted;
120 115
121 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; 116 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap;
122 IDBIndexMap m_indexMap; 117 IDBIndexMap m_indexMap;
123 }; 118 };
124 119
125 } // namespace WebCore 120 } // namespace WebCore
126 121
127 #endif // IDBObjectStore_h 122 #endif // IDBObjectStore_h
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.idl ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698