Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 m_hasErrorCallback(m_frontend->hasErrorCallback()), | 101 m_hasErrorCallback(m_frontend->hasErrorCallback()), |
| 102 m_resultSet(SQLResultSet::create()), | 102 m_resultSet(SQLResultSet::create()), |
| 103 m_permissions(permissions) { | 103 m_permissions(permissions) { |
| 104 DCHECK(isMainThread()); | 104 DCHECK(isMainThread()); |
| 105 | 105 |
| 106 m_frontend->setBackend(this); | 106 m_frontend->setBackend(this); |
| 107 } | 107 } |
| 108 | 108 |
| 109 DEFINE_TRACE(SQLStatementBackend) { | 109 DEFINE_TRACE(SQLStatementBackend) { |
| 110 visitor->trace(m_frontend); | 110 visitor->trace(m_frontend); |
| 111 visitor->trace(m_resultSet); | |
| 112 } | 111 } |
| 113 | 112 |
| 114 SQLStatement* SQLStatementBackend::frontend() { | 113 SQLStatement* SQLStatementBackend::frontend() { |
| 115 return m_frontend.get(); | 114 return m_frontend.get(); |
| 116 } | 115 } |
| 117 | 116 |
| 118 SQLErrorData* SQLStatementBackend::sqlError() const { | 117 SQLErrorData* SQLStatementBackend::sqlError() const { |
| 119 return m_error.get(); | 118 return m_error.get(); |
| 120 } | 119 } |
| 121 | 120 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 SQLErrorData::create(SQLError::kDatabaseErr, "could not bind value", | 185 SQLErrorData::create(SQLError::kDatabaseErr, "could not bind value", |
| 187 result, database->lastErrorMsg()); | 186 result, database->lastErrorMsg()); |
| 188 return false; | 187 return false; |
| 189 } | 188 } |
| 190 } | 189 } |
| 191 | 190 |
| 192 // Step so we can fetch the column names. | 191 // Step so we can fetch the column names. |
| 193 result = statement.step(); | 192 result = statement.step(); |
| 194 if (result == SQLResultRow) { | 193 if (result == SQLResultRow) { |
| 195 int columnCount = statement.columnCount(); | 194 int columnCount = statement.columnCount(); |
| 196 SQLResultSetRowList* rows = m_resultSet->rows(); | 195 CrossThreadPersistent<SQLResultSetRowList> rows = m_resultSet->rows(); |
|
sof
2017/01/17 14:13:03
This too I'm also not understanding -- if a thread
| |
| 197 | 196 |
| 198 for (int i = 0; i < columnCount; i++) | 197 for (int i = 0; i < columnCount; i++) |
| 199 rows->addColumn(statement.getColumnName(i)); | 198 rows->addColumn(statement.getColumnName(i)); |
| 200 | 199 |
| 201 do { | 200 do { |
| 202 for (int i = 0; i < columnCount; i++) | 201 for (int i = 0; i < columnCount; i++) |
| 203 rows->addResult(statement.getColumnValue(i)); | 202 rows->addResult(statement.getColumnValue(i)); |
| 204 | 203 |
| 205 result = statement.step(); | 204 result = statement.step(); |
| 206 } while (result == SQLResultRow); | 205 } while (result == SQLResultRow); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 void SQLStatementBackend::clearFailureDueToQuota() { | 265 void SQLStatementBackend::clearFailureDueToQuota() { |
| 267 if (lastExecutionFailedDueToQuota()) | 266 if (lastExecutionFailedDueToQuota()) |
| 268 m_error = nullptr; | 267 m_error = nullptr; |
| 269 } | 268 } |
| 270 | 269 |
| 271 bool SQLStatementBackend::lastExecutionFailedDueToQuota() const { | 270 bool SQLStatementBackend::lastExecutionFailedDueToQuota() const { |
| 272 return m_error && m_error->code() == SQLError::kQuotaErr; | 271 return m_error && m_error->code() == SQLError::kQuotaErr; |
| 273 } | 272 } |
| 274 | 273 |
| 275 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |