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

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

Issue 236783002: Pass NewScriptState to idbAnyToScriptValue() and idbKeyToScriptValue() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 public: 53 public:
54 static PassRefPtr<IDBObjectStore> create(const IDBObjectStoreMetadata& metad ata, IDBTransaction* transaction) 54 static PassRefPtr<IDBObjectStore> create(const IDBObjectStoreMetadata& metad ata, IDBTransaction* transaction)
55 { 55 {
56 return adoptRef(new IDBObjectStore(metadata, transaction)); 56 return adoptRef(new IDBObjectStore(metadata, transaction));
57 } 57 }
58 ~IDBObjectStore() { } 58 ~IDBObjectStore() { }
59 59
60 // Implement the IDBObjectStore IDL 60 // Implement the IDBObjectStore IDL
61 int64_t id() const { return m_metadata.id; } 61 int64_t id() const { return m_metadata.id; }
62 const String& name() const { return m_metadata.name; } 62 const String& name() const { return m_metadata.name; }
63 ScriptValue keyPath(ExecutionContext*) const; 63 ScriptValue keyPath(NewScriptState*) const;
64 PassRefPtr<DOMStringList> indexNames() const; 64 PassRefPtr<DOMStringList> indexNames() const;
65 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } 65 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
66 bool autoIncrement() const { return m_metadata.autoIncrement; } 66 bool autoIncrement() const { return m_metadata.autoIncrement; }
67 67
68 PassRefPtr<IDBRequest> openCursor(ExecutionContext*, const ScriptValue& rang e, const String& direction, ExceptionState&); 68 PassRefPtr<IDBRequest> openCursor(ExecutionContext*, const ScriptValue& rang e, const String& direction, ExceptionState&);
69 PassRefPtr<IDBRequest> openKeyCursor(ExecutionContext*, const ScriptValue& r ange, const String& direction, ExceptionState&); 69 PassRefPtr<IDBRequest> openKeyCursor(ExecutionContext*, const ScriptValue& r ange, const String& direction, ExceptionState&);
70 PassRefPtr<IDBRequest> get(ExecutionContext*, const ScriptValue& key, Except ionState&); 70 PassRefPtr<IDBRequest> get(ExecutionContext*, const ScriptValue& key, Except ionState&);
71 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&); 71 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&);
72 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&); 72 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke y, ExceptionState&);
73 PassRefPtr<IDBRequest> deleteFunction(ExecutionContext*, const ScriptValue& key, ExceptionState&); 73 PassRefPtr<IDBRequest> deleteFunction(ExecutionContext*, const ScriptValue& key, ExceptionState&);
74 PassRefPtr<IDBRequest> clear(ExecutionContext*, ExceptionState&); 74 PassRefPtr<IDBRequest> clear(ExecutionContext*, ExceptionState&);
75 75
76 PassRefPtr<IDBIndex> createIndex(ExecutionContext* context, const String& na me, const String& keyPath, const Dictionary& options, ExceptionState& exceptionS tate) { return createIndex(context, name, IDBKeyPath(keyPath), options, exceptio nState); } 76 PassRefPtr<IDBIndex> createIndex(NewScriptState* scriptState, const String& name, const String& keyPath, const Dictionary& options, ExceptionState& exceptio nState)
77 PassRefPtr<IDBIndex> createIndex(ExecutionContext* context, const String& na me, const Vector<String>& keyPath, const Dictionary& options, ExceptionState& ex ceptionState) { return createIndex(context, name, IDBKeyPath(keyPath), options, exceptionState); } 77 {
78 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce ptionState);
79 }
80 PassRefPtr<IDBIndex> createIndex(NewScriptState* scriptState, const String& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionState& exceptionState)
81 {
82 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce ptionState);
83 }
78 PassRefPtr<IDBIndex> index(const String& name, ExceptionState&); 84 PassRefPtr<IDBIndex> index(const String& name, ExceptionState&);
79 void deleteIndex(const String& name, ExceptionState&); 85 void deleteIndex(const String& name, ExceptionState&);
80 86
81 PassRefPtr<IDBRequest> count(ExecutionContext*, const ScriptValue& range, Ex ceptionState&); 87 PassRefPtr<IDBRequest> count(ExecutionContext*, const ScriptValue& range, Ex ceptionState&);
82 88
83 // Used by IDBCursor::update(): 89 // Used by IDBCursor::update():
84 PassRefPtr<IDBRequest> put(blink::WebIDBDatabase::PutMode, PassRefPtr<IDBAny > source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionState&); 90 PassRefPtr<IDBRequest> put(blink::WebIDBDatabase::PutMode, PassRefPtr<IDBAny > source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionState&);
85 91
86 // Used internally and by InspectorIndexedDBAgent: 92 // Used internally and by InspectorIndexedDBAgent:
87 PassRefPtr<IDBRequest> openCursor(ExecutionContext*, PassRefPtr<IDBKeyRange> , blink::WebIDBCursor::Direction, blink::WebIDBDatabase::TaskType = blink::WebID BDatabase::NormalTask); 93 PassRefPtr<IDBRequest> openCursor(ExecutionContext*, PassRefPtr<IDBKeyRange> , blink::WebIDBCursor::Direction, blink::WebIDBDatabase::TaskType = blink::WebID BDatabase::NormalTask);
88 94
89 void markDeleted() { m_deleted = true; } 95 void markDeleted() { m_deleted = true; }
90 bool isDeleted() const { return m_deleted; } 96 bool isDeleted() const { return m_deleted; }
91 void transactionFinished(); 97 void transactionFinished();
92 98
93 const IDBObjectStoreMetadata& metadata() const { return m_metadata; } 99 const IDBObjectStoreMetadata& metadata() const { return m_metadata; }
94 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; } 100 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta data; }
95 101
96 typedef Vector<RefPtr<IDBKey> > IndexKeys; 102 typedef Vector<RefPtr<IDBKey> > IndexKeys;
97 typedef HashMap<String, IndexKeys> IndexKeyMap; 103 typedef HashMap<String, IndexKeys> IndexKeyMap;
98 104
99 blink::WebIDBDatabase* backendDB() const; 105 blink::WebIDBDatabase* backendDB() const;
100 106
101 private: 107 private:
102 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); 108 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*);
103 109
104 PassRefPtr<IDBIndex> createIndex(ExecutionContext*, const String& name, cons t IDBKeyPath&, const Dictionary&, ExceptionState&); 110 PassRefPtr<IDBIndex> createIndex(NewScriptState*, const String& name, const IDBKeyPath&, const Dictionary&, ExceptionState&);
105 PassRefPtr<IDBIndex> createIndex(ExecutionContext*, const String& name, cons t IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&); 111 PassRefPtr<IDBIndex> createIndex(NewScriptState*, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&);
106 PassRefPtr<IDBRequest> put(blink::WebIDBDatabase::PutMode, PassRefPtr<IDBAny > source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionState&); 112 PassRefPtr<IDBRequest> put(blink::WebIDBDatabase::PutMode, PassRefPtr<IDBAny > source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionState&);
107 113
108 int64_t findIndexId(const String& name) const; 114 int64_t findIndexId(const String& name) const;
109 bool containsIndex(const String& name) const 115 bool containsIndex(const String& name) const
110 { 116 {
111 return findIndexId(name) != IDBIndexMetadata::InvalidId; 117 return findIndexId(name) != IDBIndexMetadata::InvalidId;
112 } 118 }
113 119
114 IDBObjectStoreMetadata m_metadata; 120 IDBObjectStoreMetadata m_metadata;
115 RefPtr<IDBTransaction> m_transaction; 121 RefPtr<IDBTransaction> m_transaction;
116 bool m_deleted; 122 bool m_deleted;
117 123
118 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; 124 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap;
119 IDBIndexMap m_indexMap; 125 IDBIndexMap m_indexMap;
120 }; 126 };
121 127
122 } // namespace WebCore 128 } // namespace WebCore
123 129
124 #endif // IDBObjectStore_h 130 #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