| OLD | NEW |
| 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 Loading... |
| 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 if (hasCallback() || hasErrorCallback()) |
| 59 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti
ng(database->getExecutionContext(), "SQLStatement"); | 58 InspectorInstrumentation::asyncTaskScheduled(database->getExecutionConte
xt(), "SQLStatement", this); |
| 60 } | 59 } |
| 61 | 60 |
| 62 SQLStatement::~SQLStatement() | 61 SQLStatement::~SQLStatement() |
| 63 { | 62 { |
| 64 } | 63 } |
| 65 | 64 |
| 66 DEFINE_TRACE(SQLStatement) | 65 DEFINE_TRACE(SQLStatement) |
| 67 { | 66 { |
| 68 visitor->trace(m_backend); | 67 visitor->trace(m_backend); |
| 69 visitor->trace(m_statementCallback); | 68 visitor->trace(m_statementCallback); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 89 { | 88 { |
| 90 ASSERT(transaction); | 89 ASSERT(transaction); |
| 91 ASSERT(m_backend); | 90 ASSERT(m_backend); |
| 92 | 91 |
| 93 bool callbackError = false; | 92 bool callbackError = false; |
| 94 | 93 |
| 95 SQLStatementCallback* callback = m_statementCallback.release(); | 94 SQLStatementCallback* callback = m_statementCallback.release(); |
| 96 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release(
); | 95 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release(
); |
| 97 SQLErrorData* error = m_backend->sqlError(); | 96 SQLErrorData* error = m_backend->sqlError(); |
| 98 | 97 |
| 99 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
OperationCompletedCallbackStarting(transaction->database()->getExecutionContext(
), m_asyncOperationId); | 98 InspectorInstrumentation::AsyncTask asyncTask(transaction->database()->getEx
ecutionContext(), this); |
| 100 | 99 |
| 101 // Call the appropriate statement callback and track if it resulted in an er
ror, | 100 // 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. | 101 // because then we need to jump to the transaction error callback. |
| 103 if (error) { | 102 if (error) { |
| 104 if (errorCallback) | 103 if (errorCallback) |
| 105 callbackError = errorCallback->handleEvent(transaction, SQLError::cr
eate(*error)); | 104 callbackError = errorCallback->handleEvent(transaction, SQLError::cr
eate(*error)); |
| 106 } else if (callback) { | 105 } else if (callback) { |
| 107 callbackError = !callback->handleEvent(transaction, m_backend->sqlResult
Set()); | 106 callbackError = !callback->handleEvent(transaction, m_backend->sqlResult
Set()); |
| 108 } | 107 } |
| 109 | 108 |
| 110 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | |
| 111 | |
| 112 return callbackError; | 109 return callbackError; |
| 113 } | 110 } |
| 114 | 111 |
| 115 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |