| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * 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 * | 10 * |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) | 55 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) |
| 56 { | 56 { |
| 57 return adoptPtr(new WebIDBCallbacksImpl(request)); | 57 return adoptPtr(new WebIDBCallbacksImpl(request)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) | 60 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) |
| 61 : m_request(request) | 61 : m_request(request) |
| 62 { | 62 { |
| 63 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(m
_request->executionContext(), "IndexedDB"); | 63 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(m
_request->getExecutionContext(), "IndexedDB"); |
| 64 } | 64 } |
| 65 | 65 |
| 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
| 67 { | 67 { |
| 68 InspectorInstrumentation::traceAsyncOperationCompleted(m_request->executionC
ontext(), m_asyncOperationId); | 68 InspectorInstrumentation::traceAsyncOperationCompleted(m_request->getExecuti
onContext(), m_asyncOperationId); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) | 71 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) |
| 72 { | 72 { |
| 73 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 73 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 74 m_request->onError(DOMException::create(error.code(), error.message())); | 74 m_request->onError(DOMException::create(error.code(), error.message())); |
| 75 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 75 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) | 78 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) |
| 79 { | 79 { |
| 80 Vector<String> stringList; | 80 Vector<String> stringList; |
| 81 for (size_t i = 0; i < webStringList.size(); ++i) | 81 for (size_t i = 0; i < webStringList.size(); ++i) |
| 82 stringList.append(webStringList[i]); | 82 stringList.append(webStringList[i]); |
| 83 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 83 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 84 m_request->onSuccess(stringList); | 84 m_request->onSuccess(stringList); |
| 85 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 85 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) | 88 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) |
| 89 { | 89 { |
| 90 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 90 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 91 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); | 91 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); |
| 92 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 92 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) | 95 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) |
| 96 { | 96 { |
| 97 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 97 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 98 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); | 98 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); |
| 99 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 99 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 102 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
| 103 { | 103 { |
| 104 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 104 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 105 m_request->onSuccess(key); | 105 m_request->onSuccess(key); |
| 106 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 106 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) | 109 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) |
| 110 { | 110 { |
| 111 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 111 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 112 m_request->onSuccess(IDBValue::create(value)); | 112 m_request->onSuccess(IDBValue::create(value)); |
| 113 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 113 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebIDBValue>& values) | 116 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebIDBValue>& values) |
| 117 { | 117 { |
| 118 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 118 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 119 Vector<RefPtr<IDBValue>> idbValues(values.size()); | 119 Vector<RefPtr<IDBValue>> idbValues(values.size()); |
| 120 for (size_t i = 0; i < values.size(); ++i) | 120 for (size_t i = 0; i < values.size(); ++i) |
| 121 idbValues[i] = IDBValue::create(values[i]); | 121 idbValues[i] = IDBValue::create(values[i]); |
| 122 m_request->onSuccess(idbValues); | 122 m_request->onSuccess(idbValues); |
| 123 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 123 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void WebIDBCallbacksImpl::onSuccess(long long value) | 126 void WebIDBCallbacksImpl::onSuccess(long long value) |
| 127 { | 127 { |
| 128 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 128 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 129 m_request->onSuccess(value); | 129 m_request->onSuccess(value); |
| 130 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 130 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void WebIDBCallbacksImpl::onSuccess() | 133 void WebIDBCallbacksImpl::onSuccess() |
| 134 { | 134 { |
| 135 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 135 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 136 m_request->onSuccess(); | 136 m_request->onSuccess(); |
| 137 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 137 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima
ryKey, const WebIDBValue& value) | 140 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima
ryKey, const WebIDBValue& value) |
| 141 { | 141 { |
| 142 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 142 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 143 m_request->onSuccess(key, primaryKey, IDBValue::create(value)); | 143 m_request->onSuccess(key, primaryKey, IDBValue::create(value)); |
| 144 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 144 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) | 147 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
| 148 { | 148 { |
| 149 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 149 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 150 m_request->onBlocked(oldVersion); | 150 m_request->onBlocked(oldVersion); |
| 151 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 151 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) | 154 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) |
| 155 { | 155 { |
| 156 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->executionContext(), m_asyncOperationId); | 156 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); |
| 157 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); | 157 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); |
| 158 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 158 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |