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

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

Issue 1402103004: Oilpan: Factor out GC-related enum definitions to BlinkGC.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 CString query = m_query.stripWhiteSpace().utf8(); 100 CString query = m_query.stripWhiteSpace().utf8();
101 101
102 // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race 102 // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race
103 // with Oilpan stack scanning. 103 // with Oilpan stack scanning.
104 OwnPtr<const char*> tail = adoptPtr(new const char*); 104 OwnPtr<const char*> tail = adoptPtr(new const char*);
105 OwnPtr<sqlite3_stmt*> statement = adoptPtr(new sqlite3_stmt*); 105 OwnPtr<sqlite3_stmt*> statement = adoptPtr(new sqlite3_stmt*);
106 *tail = nullptr; 106 *tail = nullptr;
107 *statement = nullptr; 107 *statement = nullptr;
108 int error; 108 int error;
109 { 109 {
110 SafePointScope scope(ThreadState::HeapPointersOnStack); 110 SafePointScope scope(BlinkGC::HeapPointersOnStack);
111 111
112 WTF_LOG(SQLDatabase, "SQL - prepare - %s", query.data()); 112 WTF_LOG(SQLDatabase, "SQL - prepare - %s", query.data());
113 113
114 // Pass the length of the string including the null character to sqlite3 _prepare_v2; 114 // Pass the length of the string including the null character to sqlite3 _prepare_v2;
115 // this lets SQLite avoid an extra string copy. 115 // this lets SQLite avoid an extra string copy.
116 size_t lengthIncludingNullCharacter = query.length() + 1; 116 size_t lengthIncludingNullCharacter = query.length() + 1;
117 117
118 error = sqlite3_prepare_v2(m_database.sqlite3Handle(), query.data(), len gthIncludingNullCharacter, statement.get(), tail.get()); 118 error = sqlite3_prepare_v2(m_database.sqlite3Handle(), query.data(), len gthIncludingNullCharacter, statement.get(), tail.get());
119 } 119 }
120 m_statement = *statement; 120 m_statement = *statement;
121 121
122 if (error != SQLITE_OK) 122 if (error != SQLITE_OK)
123 WTF_LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, que ry.data(), sqlite3_errmsg(m_database.sqlite3Handle())); 123 WTF_LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, que ry.data(), sqlite3_errmsg(m_database.sqlite3Handle()));
124 else if (*tail && **tail) 124 else if (*tail && **tail)
125 error = SQLITE_ERROR; 125 error = SQLITE_ERROR;
126 126
127 #if ENABLE(ASSERT) 127 #if ENABLE(ASSERT)
128 m_isPrepared = error == SQLITE_OK; 128 m_isPrepared = error == SQLITE_OK;
129 #endif 129 #endif
130 return restrictError(error); 130 return restrictError(error);
131 } 131 }
132 132
133 int SQLiteStatement::step() 133 int SQLiteStatement::step()
134 { 134 {
135 SafePointScope scope(ThreadState::HeapPointersOnStack); 135 SafePointScope scope(BlinkGC::HeapPointersOnStack);
136 //ASSERT(m_isPrepared); 136 //ASSERT(m_isPrepared);
137 137
138 if (!m_statement) 138 if (!m_statement)
139 return SQLITE_OK; 139 return SQLITE_OK;
140 140
141 // The database needs to update its last changes count before each statement 141 // The database needs to update its last changes count before each statement
142 // in order to compute properly the lastChanges() return value. 142 // in order to compute properly the lastChanges() return value.
143 m_database.updateLastChangesCount(); 143 m_database.updateLastChangesCount();
144 144
145 WTF_LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data()); 145 WTF_LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ASSERT(col >= 0); 308 ASSERT(col >= 0);
309 if (!m_statement) 309 if (!m_statement)
310 if (prepareAndStep() != SQLITE_ROW) 310 if (prepareAndStep() != SQLITE_ROW)
311 return 0; 311 return 0;
312 if (columnCount() <= col) 312 if (columnCount() <= col)
313 return 0; 313 return 0;
314 return sqlite3_column_int64(m_statement, col); 314 return sqlite3_column_int64(m_statement, col);
315 } 315 }
316 316
317 } // namespace blink 317 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698