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

Side by Side Diff: sql/statement.cc

Issue 1349863003: [sql] Use memory-mapped I/O for sql::Connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Speling chaneg. Created 5 years, 3 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
« no previous file with comments | « sql/connection_unittest.cc ('k') | sync/syncable/directory_backing_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sql/statement.h" 5 #include "sql/statement.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "third_party/sqlite/sqlite3.h" 10 #include "third_party/sqlite/sqlite3.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // StepInternal() cannot track success because statements may be reset 104 // StepInternal() cannot track success because statements may be reset
105 // before reaching SQLITE_DONE. Don't call CheckError() because 105 // before reaching SQLITE_DONE. Don't call CheckError() because
106 // sqlite3_reset() returns the last step error, which StepInternal() already 106 // sqlite3_reset() returns the last step error, which StepInternal() already
107 // checked. 107 // checked.
108 const int rc =sqlite3_reset(ref_->stmt()); 108 const int rc =sqlite3_reset(ref_->stmt());
109 if (rc == SQLITE_OK && ref_->connection()) 109 if (rc == SQLITE_OK && ref_->connection())
110 ref_->connection()->RecordOneEvent(Connection::EVENT_STATEMENT_SUCCESS); 110 ref_->connection()->RecordOneEvent(Connection::EVENT_STATEMENT_SUCCESS);
111 } 111 }
112 112
113 // Potentially release dirty cache pages if an autocommit statement made
114 // changes.
115 if (ref_->connection())
116 ref_->connection()->ReleaseCacheMemoryIfNeeded(false);
117
113 succeeded_ = false; 118 succeeded_ = false;
114 stepped_ = false; 119 stepped_ = false;
115 } 120 }
116 121
117 bool Statement::Succeeded() const { 122 bool Statement::Succeeded() const {
118 if (!is_valid()) 123 if (!is_valid())
119 return false; 124 return false;
120 125
121 return succeeded_; 126 return succeeded_;
122 } 127 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 354
350 int Statement::CheckError(int err) { 355 int Statement::CheckError(int err) {
351 // Please don't add DCHECKs here, OnSqliteError() already has them. 356 // Please don't add DCHECKs here, OnSqliteError() already has them.
352 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); 357 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE);
353 if (!succeeded_ && ref_.get() && ref_->connection()) 358 if (!succeeded_ && ref_.get() && ref_->connection())
354 return ref_->connection()->OnSqliteError(err, this, NULL); 359 return ref_->connection()->OnSqliteError(err, this, NULL);
355 return err; 360 return err;
356 } 361 }
357 362
358 } // namespace sql 363 } // namespace sql
OLDNEW
« no previous file with comments | « sql/connection_unittest.cc ('k') | sync/syncable/directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698