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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 bool SQLStatement::HasCallback() { | 73 bool SQLStatement::HasCallback() { |
74 return statement_callback_; | 74 return statement_callback_; |
75 } | 75 } |
76 | 76 |
77 bool SQLStatement::HasErrorCallback() { | 77 bool SQLStatement::HasErrorCallback() { |
78 return statement_error_callback_; | 78 return statement_error_callback_; |
79 } | 79 } |
80 | 80 |
81 bool SQLStatement::PerformCallback(SQLTransaction* transaction) { | 81 bool SQLStatement::PerformCallback(SQLTransaction* transaction) { |
82 ASSERT(transaction); | 82 DCHECK(transaction); |
83 ASSERT(backend_); | 83 DCHECK(backend_); |
84 | 84 |
85 bool callback_error = false; | 85 bool callback_error = false; |
86 | 86 |
87 SQLStatementCallback* callback = statement_callback_.Release(); | 87 SQLStatementCallback* callback = statement_callback_.Release(); |
88 SQLStatementErrorCallback* error_callback = | 88 SQLStatementErrorCallback* error_callback = |
89 statement_error_callback_.Release(); | 89 statement_error_callback_.Release(); |
90 SQLErrorData* error = backend_->SqlError(); | 90 SQLErrorData* error = backend_->SqlError(); |
91 | 91 |
92 probe::AsyncTask async_task(transaction->GetDatabase()->GetExecutionContext(), | 92 probe::AsyncTask async_task(transaction->GetDatabase()->GetExecutionContext(), |
93 this); | 93 this); |
94 | 94 |
95 // Call the appropriate statement callback and track if it resulted in an | 95 // Call the appropriate statement callback and track if it resulted in an |
96 // error, because then we need to jump to the transaction error callback. | 96 // error, because then we need to jump to the transaction error callback. |
97 if (error) { | 97 if (error) { |
98 if (error_callback) | 98 if (error_callback) |
99 callback_error = | 99 callback_error = |
100 error_callback->handleEvent(transaction, SQLError::Create(*error)); | 100 error_callback->handleEvent(transaction, SQLError::Create(*error)); |
101 } else if (callback) { | 101 } else if (callback) { |
102 callback_error = | 102 callback_error = |
103 !callback->handleEvent(transaction, backend_->SqlResultSet()); | 103 !callback->handleEvent(transaction, backend_->SqlResultSet()); |
104 } | 104 } |
105 | 105 |
106 return callback_error; | 106 return callback_error; |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |