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

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

Issue 1007703003: [bindings] Utilize ScriptValue::from and remove IDB* => ScriptValue conversion methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
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 13 matching lines...) Expand all
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "modules/indexeddb/IDBRequest.h" 30 #include "modules/indexeddb/IDBRequest.h"
31 31
32 #include "bindings/core/v8/ExceptionState.h" 32 #include "bindings/core/v8/ExceptionState.h"
33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
34 #include "bindings/modules/v8/ToV8ForModules.h"
34 #include "bindings/modules/v8/V8BindingForModules.h" 35 #include "bindings/modules/v8/V8BindingForModules.h"
35 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
36 #include "core/events/EventQueue.h" 37 #include "core/events/EventQueue.h"
37 #include "modules/IndexedDBNames.h" 38 #include "modules/IndexedDBNames.h"
38 #include "modules/indexeddb/IDBCursorWithValue.h" 39 #include "modules/indexeddb/IDBCursorWithValue.h"
39 #include "modules/indexeddb/IDBDatabase.h" 40 #include "modules/indexeddb/IDBDatabase.h"
40 #include "modules/indexeddb/IDBEventDispatcher.h" 41 #include "modules/indexeddb/IDBEventDispatcher.h"
41 #include "modules/indexeddb/IDBTracing.h" 42 #include "modules/indexeddb/IDBTracing.h"
42 #include "platform/SharedBuffer.h" 43 #include "platform/SharedBuffer.h"
43 #include "public/platform/WebBlobInfo.h" 44 #include "public/platform/WebBlobInfo.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 ScriptValue IDBRequest::result(ExceptionState& exceptionState) 99 ScriptValue IDBRequest::result(ExceptionState& exceptionState)
99 { 100 {
100 if (m_readyState != DONE) { 101 if (m_readyState != DONE) {
101 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage); 102 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage);
102 return ScriptValue(); 103 return ScriptValue();
103 } 104 }
104 if (m_contextStopped || !executionContext()) 105 if (m_contextStopped || !executionContext())
105 return ScriptValue(); 106 return ScriptValue();
106 m_resultDirty = false; 107 m_resultDirty = false;
107 ScriptValue value = idbAnyToScriptValue(m_scriptState.get(), m_result); 108 ScriptValue value = ScriptValue::from(m_scriptState.get(), m_result);
108 return value; 109 return value;
109 } 110 }
110 111
111 DOMError* IDBRequest::error(ExceptionState& exceptionState) const 112 DOMError* IDBRequest::error(ExceptionState& exceptionState) const
112 { 113 {
113 if (m_readyState != DONE) { 114 if (m_readyState != DONE) {
114 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage); 115 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage);
115 return nullptr; 116 return nullptr;
116 } 117 }
117 return m_error; 118 return m_error;
118 } 119 }
119 120
120 ScriptValue IDBRequest::source() const 121 ScriptValue IDBRequest::source() const
121 { 122 {
122 if (m_contextStopped || !executionContext()) 123 if (m_contextStopped || !executionContext())
123 return ScriptValue(); 124 return ScriptValue();
124 125
125 return idbAnyToScriptValue(m_scriptState.get(), m_source); 126 return ScriptValue::from(m_scriptState.get(), m_source);
126 } 127 }
127 128
128 const String& IDBRequest::readyState() const 129 const String& IDBRequest::readyState() const
129 { 130 {
130 ASSERT(m_readyState == PENDING || m_readyState == DONE); 131 ASSERT(m_readyState == PENDING || m_readyState == DONE);
131 132
132 if (m_readyState == PENDING) 133 if (m_readyState == PENDING)
133 return IndexedDBNames::pending; 134 return IndexedDBNames::pending;
134 135
135 return IndexedDBNames::done; 136 return IndexedDBNames::done;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 Vector<String> IDBRequest::IDBBlobHolder::getUUIDs() const 551 Vector<String> IDBRequest::IDBBlobHolder::getUUIDs() const
551 { 552 {
552 Vector<String> uuids; 553 Vector<String> uuids;
553 uuids.reserveCapacity(m_blobInfo->size()); 554 uuids.reserveCapacity(m_blobInfo->size());
554 for (const auto& info : *m_blobInfo) 555 for (const auto& info : *m_blobInfo)
555 uuids.append(info.uuid()); 556 uuids.append(info.uuid());
556 return uuids; 557 return uuids;
557 } 558 }
558 559
559 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698