| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 SQLStatementErrorCallback* errorCallback) { | 47 SQLStatementErrorCallback* errorCallback) { |
| 48 return new SQLStatement(database, callback, errorCallback); | 48 return new SQLStatement(database, callback, errorCallback); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SQLStatement::SQLStatement(Database* database, | 51 SQLStatement::SQLStatement(Database* database, |
| 52 SQLStatementCallback* callback, | 52 SQLStatementCallback* callback, |
| 53 SQLStatementErrorCallback* errorCallback) | 53 SQLStatementErrorCallback* errorCallback) |
| 54 : m_statementCallback(callback), m_statementErrorCallback(errorCallback) { | 54 : m_statementCallback(callback), m_statementErrorCallback(errorCallback) { |
| 55 DCHECK(isMainThread()); | 55 DCHECK(isMainThread()); |
| 56 | 56 |
| 57 if (hasCallback() || hasErrorCallback()) | 57 if (hasCallback() || hasErrorCallback()) { |
| 58 InspectorInstrumentation::asyncTaskScheduled( | 58 probe::asyncTaskScheduled(database->getExecutionContext(), "SQLStatement", |
| 59 database->getExecutionContext(), "SQLStatement", this); | 59 this); |
| 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 62 DEFINE_TRACE(SQLStatement) { | 63 DEFINE_TRACE(SQLStatement) { |
| 63 visitor->trace(m_backend); | 64 visitor->trace(m_backend); |
| 64 visitor->trace(m_statementCallback); | 65 visitor->trace(m_statementCallback); |
| 65 visitor->trace(m_statementErrorCallback); | 66 visitor->trace(m_statementErrorCallback); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void SQLStatement::setBackend(SQLStatementBackend* backend) { | 69 void SQLStatement::setBackend(SQLStatementBackend* backend) { |
| 69 m_backend = backend; | 70 m_backend = backend; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 bool SQLStatement::performCallback(SQLTransaction* transaction) { | 81 bool SQLStatement::performCallback(SQLTransaction* transaction) { |
| 81 ASSERT(transaction); | 82 ASSERT(transaction); |
| 82 ASSERT(m_backend); | 83 ASSERT(m_backend); |
| 83 | 84 |
| 84 bool callbackError = false; | 85 bool callbackError = false; |
| 85 | 86 |
| 86 SQLStatementCallback* callback = m_statementCallback.release(); | 87 SQLStatementCallback* callback = m_statementCallback.release(); |
| 87 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release(); | 88 SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release(); |
| 88 SQLErrorData* error = m_backend->sqlError(); | 89 SQLErrorData* error = m_backend->sqlError(); |
| 89 | 90 |
| 90 InspectorInstrumentation::AsyncTask asyncTask( | 91 probe::AsyncTask asyncTask(transaction->database()->getExecutionContext(), |
| 91 transaction->database()->getExecutionContext(), this); | 92 this); |
| 92 | 93 |
| 93 // Call the appropriate statement callback and track if it resulted in an | 94 // Call the appropriate statement callback and track if it resulted in an |
| 94 // error, because then we need to jump to the transaction error callback. | 95 // error, because then we need to jump to the transaction error callback. |
| 95 if (error) { | 96 if (error) { |
| 96 if (errorCallback) | 97 if (errorCallback) |
| 97 callbackError = | 98 callbackError = |
| 98 errorCallback->handleEvent(transaction, SQLError::create(*error)); | 99 errorCallback->handleEvent(transaction, SQLError::create(*error)); |
| 99 } else if (callback) { | 100 } else if (callback) { |
| 100 callbackError = | 101 callbackError = |
| 101 !callback->handleEvent(transaction, m_backend->sqlResultSet()); | 102 !callback->handleEvent(transaction, m_backend->sqlResultSet()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 return callbackError; | 105 return callbackError; |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |