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

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

Issue 439713009: DevTools: Implement async stacks for IndexedDB. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/WebIDBCallbacksImpl.h ('k') | no next file » | 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) 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 12 matching lines...) Expand all
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF 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/WebIDBCallbacksImpl.h" 30 #include "modules/indexeddb/WebIDBCallbacksImpl.h"
31 31
32 #include "core/dom/DOMError.h" 32 #include "core/dom/DOMError.h"
33 #include "core/inspector/InspectorInstrumentation.h"
33 #include "modules/indexeddb/IDBMetadata.h" 34 #include "modules/indexeddb/IDBMetadata.h"
34 #include "modules/indexeddb/IDBRequest.h" 35 #include "modules/indexeddb/IDBRequest.h"
35 #include "platform/SharedBuffer.h" 36 #include "platform/SharedBuffer.h"
36 #include "public/platform/WebBlobInfo.h" 37 #include "public/platform/WebBlobInfo.h"
37 #include "public/platform/WebData.h" 38 #include "public/platform/WebData.h"
38 #include "public/platform/WebIDBCursor.h" 39 #include "public/platform/WebIDBCursor.h"
39 #include "public/platform/WebIDBDatabase.h" 40 #include "public/platform/WebIDBDatabase.h"
40 #include "public/platform/WebIDBDatabaseError.h" 41 #include "public/platform/WebIDBDatabaseError.h"
41 #include "public/platform/WebIDBKey.h" 42 #include "public/platform/WebIDBKey.h"
42 43
(...skipping 12 matching lines...) Expand all
55 56
56 // static 57 // static
57 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) 58 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request)
58 { 59 {
59 return adoptPtr(new WebIDBCallbacksImpl(request)); 60 return adoptPtr(new WebIDBCallbacksImpl(request));
60 } 61 }
61 62
62 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) 63 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request)
63 : m_request(request) 64 : m_request(request)
64 { 65 {
66 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(m _request->executionContext(), "IndexedDB");
cmumford 2014/08/07 15:11:24 Elsewhere (like in FileSystemCallbacks.cpp) a chec
aandrey 2014/08/07 15:35:40 Not necessary, the NULL check is done at https://c
65 } 67 }
66 68
67 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() 69 WebIDBCallbacksImpl::~WebIDBCallbacksImpl()
68 { 70 {
71 InspectorInstrumentation::traceAsyncOperationCompleted(m_request->executionC ontext(), m_asyncOperationId);
cmumford 2014/08/07 15:11:24 Same NULL ptr check question as constructor.
69 } 72 }
70 73
71 static PassOwnPtr<Vector<WebBlobInfo> > ConvertBlobInfo(const WebVector<WebBlobI nfo>& webBlobInfo) 74 static PassOwnPtr<Vector<WebBlobInfo> > ConvertBlobInfo(const WebVector<WebBlobI nfo>& webBlobInfo)
72 { 75 {
73 OwnPtr<Vector<WebBlobInfo> > blobInfo = adoptPtr(new Vector<WebBlobInfo>(web BlobInfo.size())); 76 OwnPtr<Vector<WebBlobInfo> > blobInfo = adoptPtr(new Vector<WebBlobInfo>(web BlobInfo.size()));
74 for (size_t i = 0; i < webBlobInfo.size(); ++i) 77 for (size_t i = 0; i < webBlobInfo.size(); ++i)
75 (*blobInfo)[i] = webBlobInfo[i]; 78 (*blobInfo)[i] = webBlobInfo[i];
76 return blobInfo.release(); 79 return blobInfo.release();
77 } 80 }
78 81
79 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) 82 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error)
80 { 83 {
84 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
81 m_request->onError(error); 85 m_request->onError(error);
86 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
82 } 87 }
83 88
84 void WebIDBCallbacksImpl::onSuccess(const WebVector<blink::WebString>& webString List) 89 void WebIDBCallbacksImpl::onSuccess(const WebVector<blink::WebString>& webString List)
85 { 90 {
86 Vector<String> stringList; 91 Vector<String> stringList;
87 for (size_t i = 0; i < webStringList.size(); ++i) 92 for (size_t i = 0; i < webStringList.size(); ++i)
88 stringList.append(webStringList[i]); 93 stringList.append(webStringList[i]);
94 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
89 m_request->onSuccess(stringList); 95 m_request->onSuccess(stringList);
96 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
90 } 97 }
91 98
92 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo) 99 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo)
93 { 100 {
101 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
94 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value, ConvertBlobIn fo(webBlobInfo)); 102 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value, ConvertBlobIn fo(webBlobInfo));
103 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
95 } 104 }
96 105
97 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat a& metadata) 106 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat a& metadata)
98 { 107 {
108 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
99 m_request->onSuccess(adoptPtr(backend), metadata); 109 m_request->onSuccess(adoptPtr(backend), metadata);
110 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
100 } 111 }
101 112
102 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) 113 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key)
103 { 114 {
115 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
104 m_request->onSuccess(key); 116 m_request->onSuccess(key);
117 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
105 } 118 }
106 119
107 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo) 120 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo)
108 { 121 {
122 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
109 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo)); 123 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo));
124 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
110 } 125 }
111 126
112 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo, const WebIDBKey& key, const WebIDBKeyPath& keyPath) 127 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo, const WebIDBKey& key, const WebIDBKeyPath& keyPath)
113 { 128 {
129 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
114 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo), key, keyPath); 130 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo), key, keyPath);
131 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
115 } 132 }
116 133
117 void WebIDBCallbacksImpl::onSuccess(long long value) 134 void WebIDBCallbacksImpl::onSuccess(long long value)
118 { 135 {
136 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
119 m_request->onSuccess(value); 137 m_request->onSuccess(value);
138 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
120 } 139 }
121 140
122 void WebIDBCallbacksImpl::onSuccess() 141 void WebIDBCallbacksImpl::onSuccess()
123 { 142 {
143 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
124 m_request->onSuccess(); 144 m_request->onSuccess();
145 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
125 } 146 }
126 147
127 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima ryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo) 148 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima ryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo)
128 { 149 {
150 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
129 m_request->onSuccess(key, primaryKey, value, ConvertBlobInfo(webBlobInfo)); 151 m_request->onSuccess(key, primaryKey, value, ConvertBlobInfo(webBlobInfo));
152 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
130 } 153 }
131 154
132 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) 155 void WebIDBCallbacksImpl::onBlocked(long long oldVersion)
133 { 156 {
157 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
134 m_request->onBlocked(oldVersion); 158 m_request->onBlocked(oldVersion);
159 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
135 } 160 }
136 161
137 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebStr ing dataLossMessage) 162 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebStr ing dataLossMessage)
138 { 163 {
164 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync CallbackStarting(m_request->executionContext(), m_asyncOperationId);
139 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_ cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage); 165 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_ cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage);
166 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
140 } 167 }
141 168
142 } // namespace blink 169 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/WebIDBCallbacksImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698