| 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->getExecutionContext(), "IndexedDB"); | 63 InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(
), "IndexedDB", this, true); |
| 64 } | 64 } |
| 65 | 65 |
| 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
| 67 { | 67 { |
| 68 InspectorInstrumentation::traceAsyncOperationCompleted(m_request->getExecuti
onContext(), m_asyncOperationId); | 68 InspectorInstrumentation::asyncTaskCanceled(m_request->getExecutionContext()
, this); |
| 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->getExecutionContext(), m_asyncOperationId); | 73 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 74 m_request->onError(DOMException::create(error.code(), error.message())); | 74 m_request->onError(DOMException::create(error.code(), error.message())); |
| 75 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 76 } | 75 } |
| 77 | 76 |
| 78 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) | 77 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) |
| 79 { | 78 { |
| 80 Vector<String> stringList; | 79 Vector<String> stringList; |
| 81 for (size_t i = 0; i < webStringList.size(); ++i) | 80 for (size_t i = 0; i < webStringList.size(); ++i) |
| 82 stringList.append(webStringList[i]); | 81 stringList.append(webStringList[i]); |
| 83 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 82 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 84 m_request->onSuccess(stringList); | 83 m_request->onSuccess(stringList); |
| 85 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 86 } | 84 } |
| 87 | 85 |
| 88 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) | 86 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) |
| 89 { | 87 { |
| 90 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 88 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 91 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); | 89 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); |
| 92 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 93 } | 90 } |
| 94 | 91 |
| 95 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) | 92 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) |
| 96 { | 93 { |
| 97 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 94 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 98 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); | 95 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); |
| 99 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 100 } | 96 } |
| 101 | 97 |
| 102 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 98 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
| 103 { | 99 { |
| 104 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 100 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 105 m_request->onSuccess(key); | 101 m_request->onSuccess(key); |
| 106 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 107 } | 102 } |
| 108 | 103 |
| 109 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) | 104 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) |
| 110 { | 105 { |
| 111 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 106 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 112 m_request->onSuccess(IDBValue::create(value)); | 107 m_request->onSuccess(IDBValue::create(value)); |
| 113 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 114 } | 108 } |
| 115 | 109 |
| 116 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebIDBValue>& values) | 110 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebIDBValue>& values) |
| 117 { | 111 { |
| 118 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 112 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 119 Vector<RefPtr<IDBValue>> idbValues(values.size()); | 113 Vector<RefPtr<IDBValue>> idbValues(values.size()); |
| 120 for (size_t i = 0; i < values.size(); ++i) | 114 for (size_t i = 0; i < values.size(); ++i) |
| 121 idbValues[i] = IDBValue::create(values[i]); | 115 idbValues[i] = IDBValue::create(values[i]); |
| 122 m_request->onSuccess(idbValues); | 116 m_request->onSuccess(idbValues); |
| 123 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 124 } | 117 } |
| 125 | 118 |
| 126 void WebIDBCallbacksImpl::onSuccess(long long value) | 119 void WebIDBCallbacksImpl::onSuccess(long long value) |
| 127 { | 120 { |
| 128 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 121 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 129 m_request->onSuccess(value); | 122 m_request->onSuccess(value); |
| 130 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 131 } | 123 } |
| 132 | 124 |
| 133 void WebIDBCallbacksImpl::onSuccess() | 125 void WebIDBCallbacksImpl::onSuccess() |
| 134 { | 126 { |
| 135 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 127 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 136 m_request->onSuccess(); | 128 m_request->onSuccess(); |
| 137 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 138 } | 129 } |
| 139 | 130 |
| 140 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima
ryKey, const WebIDBValue& value) | 131 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima
ryKey, const WebIDBValue& value) |
| 141 { | 132 { |
| 142 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 133 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 143 m_request->onSuccess(key, primaryKey, IDBValue::create(value)); | 134 m_request->onSuccess(key, primaryKey, IDBValue::create(value)); |
| 144 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 145 } | 135 } |
| 146 | 136 |
| 147 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) | 137 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
| 148 { | 138 { |
| 149 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 139 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 150 m_request->onBlocked(oldVersion); | 140 m_request->onBlocked(oldVersion); |
| 151 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 152 } | 141 } |
| 153 | 142 |
| 154 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) | 143 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) |
| 155 { | 144 { |
| 156 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(m_request->getExecutionContext(), m_asyncOperationId); | 145 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 157 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); | 146 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); |
| 158 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 159 } | 147 } |
| 160 | 148 |
| 161 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |