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

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

Issue 1857713004: DevTools: simplify the async instrumentation harness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: same with scriptpromiseresolver Created 4 years, 8 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, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 SQLStatement* SQLStatement::create(Database* database, 46 SQLStatement* SQLStatement::create(Database* database,
47 SQLStatementCallback* callback, SQLStatementErrorCallback* errorCallback) 47 SQLStatementCallback* callback, SQLStatementErrorCallback* errorCallback)
48 { 48 {
49 return new SQLStatement(database, callback, errorCallback); 49 return new SQLStatement(database, callback, errorCallback);
50 } 50 }
51 51
52 SQLStatement::SQLStatement(Database* database, SQLStatementCallback* callback, 52 SQLStatement::SQLStatement(Database* database, SQLStatementCallback* callback,
53 SQLStatementErrorCallback* errorCallback) 53 SQLStatementErrorCallback* errorCallback)
54 : m_statementCallback(callback) 54 : m_statementCallback(callback)
55 , m_statementErrorCallback(errorCallback) 55 , m_statementErrorCallback(errorCallback)
56 , m_asyncOperationId(0)
57 { 56 {
58 if (hasCallback() || hasErrorCallback()) 57 InspectorInstrumentation::scheduleAsyncTask(database->getExecutionContext(), "SQLStatement", this);
dgozman 2016/04/06 02:31:08 Bring this if back.
59 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti ng(database->getExecutionContext(), "SQLStatement");
60 } 58 }
61 59
62 SQLStatement::~SQLStatement() 60 SQLStatement::~SQLStatement()
63 { 61 {
64 } 62 }
65 63
66 DEFINE_TRACE(SQLStatement) 64 DEFINE_TRACE(SQLStatement)
67 { 65 {
68 visitor->trace(m_backend); 66 visitor->trace(m_backend);
69 visitor->trace(m_statementCallback); 67 visitor->trace(m_statementCallback);
(...skipping 19 matching lines...) Expand all
89 { 87 {
90 ASSERT(transaction); 88 ASSERT(transaction);
91 ASSERT(m_backend); 89 ASSERT(m_backend);
92 90
93 bool callbackError = false; 91 bool callbackError = false;
94 92
95 SQLStatementCallback* callback = m_statementCallback.release(); 93 SQLStatementCallback* callback = m_statementCallback.release();
96 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release( ); 94 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release( );
97 SQLErrorData* error = m_backend->sqlError(); 95 SQLErrorData* error = m_backend->sqlError();
98 96
99 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(transaction->database()->getExecutionContext( ), m_asyncOperationId); 97 InspectorInstrumentation::AsyncTask asyncTask(transaction->database()->getEx ecutionContext(), this);
100 98
101 // Call the appropriate statement callback and track if it resulted in an er ror, 99 // Call the appropriate statement callback and track if it resulted in an er ror,
102 // because then we need to jump to the transaction error callback. 100 // because then we need to jump to the transaction error callback.
103 if (error) { 101 if (error) {
104 if (errorCallback) 102 if (errorCallback)
105 callbackError = errorCallback->handleEvent(transaction, SQLError::cr eate(*error)); 103 callbackError = errorCallback->handleEvent(transaction, SQLError::cr eate(*error));
106 } else if (callback) { 104 } else if (callback) {
107 callbackError = !callback->handleEvent(transaction, m_backend->sqlResult Set()); 105 callbackError = !callback->handleEvent(transaction, m_backend->sqlResult Set());
108 } 106 }
109 107
110 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
111
112 return callbackError; 108 return callbackError;
113 } 109 }
114 110
115 } // namespace blink 111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698