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

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

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/IDBObjectStore.h ('k') | Source/modules/indexeddb/IDBObjectStore.idl » ('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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 indexKeys->append(indexKey->array()[i]); 118 indexKeys->append(indexKey->array()[i]);
119 } 119 }
120 } 120 }
121 121
122 PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptState* state, ScriptValue& valu e, const ScriptValue& key, ExceptionCode& ec) 122 PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptState* state, ScriptValue& valu e, const ScriptValue& key, ExceptionCode& ec)
123 { 123 {
124 IDB_TRACE("IDBObjectStore::add"); 124 IDB_TRACE("IDBObjectStore::add");
125 return put(IDBDatabaseBackendInterface::AddOnly, IDBAny::create(this), state , value, key, ec); 125 return put(IDBDatabaseBackendInterface::AddOnly, IDBAny::create(this), state , value, key, ec);
126 } 126 }
127 127
128 PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptState* state, ScriptValue& valu e, ExceptionCode& ec)
129 {
130 IDB_TRACE("IDBObjectStore::add");
131 return put(IDBDatabaseBackendInterface::AddOnly, IDBAny::create(this), state , value, static_cast<IDBKey*>(0), ec);
132 }
133
134 PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptState* state, ScriptValue& valu e, const ScriptValue& key, ExceptionCode& ec) 128 PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptState* state, ScriptValue& valu e, const ScriptValue& key, ExceptionCode& ec)
135 { 129 {
136 IDB_TRACE("IDBObjectStore::put"); 130 IDB_TRACE("IDBObjectStore::put");
137 return put(IDBDatabaseBackendInterface::AddOrUpdate, IDBAny::create(this), s tate, value, key, ec); 131 return put(IDBDatabaseBackendInterface::AddOrUpdate, IDBAny::create(this), s tate, value, key, ec);
138 } 132 }
139 133
140 PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptState* state, ScriptValue& valu e, ExceptionCode& ec)
141 {
142 IDB_TRACE("IDBObjectStore::put");
143 return put(IDBDatabaseBackendInterface::AddOrUpdate, IDBAny::create(this), s tate, value, static_cast<IDBKey*>(0), ec);
144 }
145
146 PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, cons t ScriptValue& keyValue, ExceptionCode& ec) 134 PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, cons t ScriptValue& keyValue, ExceptionCode& ec)
147 { 135 {
148 ScriptExecutionContext* context = scriptExecutionContextFromScriptState(stat e); 136 ScriptExecutionContext* context = scriptExecutionContextFromScriptState(stat e);
149 DOMRequestState requestState(context); 137 DOMRequestState requestState(context);
150 RefPtr<IDBKey> key = scriptValueToIDBKey(&requestState, keyValue); 138 RefPtr<IDBKey> key = keyValue.isUndefined() ? 0 : scriptValueToIDBKey(&reque stState, keyValue);
151 return put(putMode, source, state, value, key.release(), ec); 139 return put(putMode, source, state, value, key.release(), ec);
152 } 140 }
153 141
154 PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, Pass RefPtr<IDBKey> prpKey, ExceptionCode& ec) 142 PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, Pass RefPtr<IDBKey> prpKey, ExceptionCode& ec)
155 { 143 {
156 RefPtr<IDBKey> key = prpKey; 144 RefPtr<IDBKey> key = prpKey;
157 if (m_deleted) { 145 if (m_deleted) {
158 ec = IDBDatabaseException::InvalidStateError; 146 ec = IDBDatabaseException::InvalidStateError;
159 return 0; 147 return 0;
160 } 148 }
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 554 }
567 return IDBIndexMetadata::InvalidId; 555 return IDBIndexMetadata::InvalidId;
568 } 556 }
569 557
570 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const 558 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const
571 { 559 {
572 return m_transaction->backendDB(); 560 return m_transaction->backendDB();
573 } 561 }
574 562
575 } // namespace WebCore 563 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBObjectStore.h ('k') | Source/modules/indexeddb/IDBObjectStore.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698