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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 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) 2007, 2008, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2013 Apple 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 SQLTransactionErrorCallback* errorCallback, 65 SQLTransactionErrorCallback* errorCallback,
66 bool readOnly) 66 bool readOnly)
67 : m_database(db), 67 : m_database(db),
68 m_callback(callback), 68 m_callback(callback),
69 m_successCallback(successCallback), 69 m_successCallback(successCallback),
70 m_errorCallback(errorCallback), 70 m_errorCallback(errorCallback),
71 m_executeSqlAllowed(false), 71 m_executeSqlAllowed(false),
72 m_readOnly(readOnly) { 72 m_readOnly(readOnly) {
73 DCHECK(isMainThread()); 73 DCHECK(isMainThread());
74 ASSERT(m_database); 74 ASSERT(m_database);
75 InspectorInstrumentation::asyncTaskScheduled(db->getExecutionContext(), 75 probe::asyncTaskScheduled(db->getExecutionContext(), "SQLTransaction", this,
76 "SQLTransaction", this, true); 76 true);
77 } 77 }
78 78
79 SQLTransaction::~SQLTransaction() {} 79 SQLTransaction::~SQLTransaction() {}
80 80
81 DEFINE_TRACE(SQLTransaction) { 81 DEFINE_TRACE(SQLTransaction) {
82 visitor->trace(m_database); 82 visitor->trace(m_database);
83 visitor->trace(m_backend); 83 visitor->trace(m_backend);
84 visitor->trace(m_callback); 84 visitor->trace(m_callback);
85 visitor->trace(m_successCallback); 85 visitor->trace(m_successCallback);
86 visitor->trace(m_errorCallback); 86 visitor->trace(m_errorCallback);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (hasErrorCallback()) 146 if (hasErrorCallback())
147 return SQLTransactionState::DeliverTransactionErrorCallback; 147 return SQLTransactionState::DeliverTransactionErrorCallback;
148 148
149 // No error callback, so fast-forward to: 149 // No error callback, so fast-forward to:
150 // Transaction Step 11 - Rollback the transaction. 150 // Transaction Step 11 - Rollback the transaction.
151 return SQLTransactionState::CleanupAfterTransactionErrorCallback; 151 return SQLTransactionState::CleanupAfterTransactionErrorCallback;
152 } 152 }
153 153
154 SQLTransactionState SQLTransaction::deliverTransactionCallback() { 154 SQLTransactionState SQLTransaction::deliverTransactionCallback() {
155 bool shouldDeliverErrorCallback = false; 155 bool shouldDeliverErrorCallback = false;
156 InspectorInstrumentation::AsyncTask asyncTask( 156 probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
157 m_database->getExecutionContext(), this);
158 157
159 // Spec 4.3.2 4: Invoke the transaction callback with the new SQLTransaction 158 // Spec 4.3.2 4: Invoke the transaction callback with the new SQLTransaction
160 // object. 159 // object.
161 if (SQLTransactionCallback* callback = m_callback.release()) { 160 if (SQLTransactionCallback* callback = m_callback.release()) {
162 m_executeSqlAllowed = true; 161 m_executeSqlAllowed = true;
163 shouldDeliverErrorCallback = !callback->handleEvent(this); 162 shouldDeliverErrorCallback = !callback->handleEvent(this);
164 m_executeSqlAllowed = false; 163 m_executeSqlAllowed = false;
165 } 164 }
166 165
167 // Spec 4.3.2 5: If the transaction callback was null or raised an exception, 166 // Spec 4.3.2 5: If the transaction callback was null or raised an exception,
168 // jump to the error callback. 167 // jump to the error callback.
169 SQLTransactionState nextState = SQLTransactionState::RunStatements; 168 SQLTransactionState nextState = SQLTransactionState::RunStatements;
170 if (shouldDeliverErrorCallback) { 169 if (shouldDeliverErrorCallback) {
171 m_database->reportStartTransactionResult(5, SQLError::kUnknownErr, 0); 170 m_database->reportStartTransactionResult(5, SQLError::kUnknownErr, 0);
172 m_transactionError = SQLErrorData::create( 171 m_transactionError = SQLErrorData::create(
173 SQLError::kUnknownErr, 172 SQLError::kUnknownErr,
174 "the SQLTransactionCallback was null or threw an exception"); 173 "the SQLTransactionCallback was null or threw an exception");
175 nextState = SQLTransactionState::DeliverTransactionErrorCallback; 174 nextState = SQLTransactionState::DeliverTransactionErrorCallback;
176 } 175 }
177 m_database->reportStartTransactionResult(0, -1, 0); // OK 176 m_database->reportStartTransactionResult(0, -1, 0); // OK
178 return nextState; 177 return nextState;
179 } 178 }
180 179
181 SQLTransactionState SQLTransaction::deliverTransactionErrorCallback() { 180 SQLTransactionState SQLTransaction::deliverTransactionErrorCallback() {
182 InspectorInstrumentation::AsyncTask asyncTask( 181 probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
183 m_database->getExecutionContext(), this); 182 probe::asyncTaskCanceled(m_database->getExecutionContext(), this);
184 InspectorInstrumentation::asyncTaskCanceled(m_database->getExecutionContext(),
185 this);
186 183
187 // Spec 4.3.2.10: If exists, invoke error callback with the last 184 // Spec 4.3.2.10: If exists, invoke error callback with the last
188 // error to have occurred in this transaction. 185 // error to have occurred in this transaction.
189 if (SQLTransactionErrorCallback* errorCallback = m_errorCallback.release()) { 186 if (SQLTransactionErrorCallback* errorCallback = m_errorCallback.release()) {
190 // If we get here with an empty m_transactionError, then the backend 187 // If we get here with an empty m_transactionError, then the backend
191 // must be waiting in the idle state waiting for this state to finish. 188 // must be waiting in the idle state waiting for this state to finish.
192 // Hence, it's thread safe to fetch the backend transactionError without 189 // Hence, it's thread safe to fetch the backend transactionError without
193 // a lock. 190 // a lock.
194 if (!m_transactionError) { 191 if (!m_transactionError) {
195 ASSERT(m_backend->transactionError()); 192 ASSERT(m_backend->transactionError());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 235
239 bool shouldRetryCurrentStatement = 236 bool shouldRetryCurrentStatement =
240 m_database->transactionClient()->didExceedQuota(database()); 237 m_database->transactionClient()->didExceedQuota(database());
241 m_backend->setShouldRetryCurrentStatement(shouldRetryCurrentStatement); 238 m_backend->setShouldRetryCurrentStatement(shouldRetryCurrentStatement);
242 239
243 return SQLTransactionState::RunStatements; 240 return SQLTransactionState::RunStatements;
244 } 241 }
245 242
246 SQLTransactionState SQLTransaction::deliverSuccessCallback() { 243 SQLTransactionState SQLTransaction::deliverSuccessCallback() {
247 DCHECK(isMainThread()); 244 DCHECK(isMainThread());
248 InspectorInstrumentation::AsyncTask asyncTask( 245 probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
249 m_database->getExecutionContext(), this); 246 probe::asyncTaskCanceled(m_database->getExecutionContext(), this);
250 InspectorInstrumentation::asyncTaskCanceled(m_database->getExecutionContext(),
251 this);
252 247
253 // Spec 4.3.2.8: Deliver success callback. 248 // Spec 4.3.2.8: Deliver success callback.
254 if (VoidCallback* successCallback = m_successCallback.release()) 249 if (VoidCallback* successCallback = m_successCallback.release())
255 successCallback->handleEvent(); 250 successCallback->handleEvent();
256 251
257 clearCallbacks(); 252 clearCallbacks();
258 253
259 // Schedule a "post-success callback" step to return control to the database 254 // Schedule a "post-success callback" step to return control to the database
260 // thread in case there are further transactions queued up for this Database. 255 // thread in case there are further transactions queued up for this Database.
261 return SQLTransactionState::CleanupAndTerminate; 256 return SQLTransactionState::CleanupAndTerminate;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 m_callback.clear(); 353 m_callback.clear();
359 m_successCallback.clear(); 354 m_successCallback.clear();
360 m_errorCallback.clear(); 355 m_errorCallback.clear();
361 } 356 }
362 357
363 SQLTransactionErrorCallback* SQLTransaction::releaseErrorCallback() { 358 SQLTransactionErrorCallback* SQLTransaction::releaseErrorCallback() {
364 return m_errorCallback.release(); 359 return m_errorCallback.release();
365 } 360 }
366 361
367 } // namespace blink 362 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698