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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc

Issue 5794003: Deinline even more destructors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/safe_browsing/safe_browsing_store_sqlite.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_store_sqlite.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 return true; 78 return true;
79 } 79 }
80 80
81 void SafeBrowsingStoreSqlite::Init(const FilePath& filename, 81 void SafeBrowsingStoreSqlite::Init(const FilePath& filename,
82 Callback0::Type* corruption_callback) { 82 Callback0::Type* corruption_callback) {
83 filename_ = filename; 83 filename_ = filename;
84 corruption_callback_.reset(corruption_callback); 84 corruption_callback_.reset(corruption_callback);
85 } 85 }
86 86
87 bool SafeBrowsingStoreSqlite::BeginChunk() {
88 return true;
89 }
90
87 bool SafeBrowsingStoreSqlite::GetAddPrefixes( 91 bool SafeBrowsingStoreSqlite::GetAddPrefixes(
88 std::vector<SBAddPrefix>* add_prefixes) { 92 std::vector<SBAddPrefix>* add_prefixes) {
89 add_prefixes->clear(); 93 add_prefixes->clear();
90 if (!Open()) return false; 94 if (!Open()) return false;
91 bool ret = ReadAddPrefixes(add_prefixes); 95 bool ret = ReadAddPrefixes(add_prefixes);
92 Close(); 96 Close();
93 return ret; 97 return ret;
94 } 98 }
95 99
100 bool SafeBrowsingStoreSqlite::WriteAddPrefix(int32 chunk_id, SBPrefix prefix) {
101 const std::vector<SBAddPrefix> prefixes(1, SBAddPrefix(chunk_id, prefix));
102 return WriteAddPrefixes(prefixes);
103 }
104
105 bool SafeBrowsingStoreSqlite::WriteAddHash(int32 chunk_id,
106 base::Time receive_time,
107 const SBFullHash& full_hash) {
108 const std::vector<SBAddFullHash>
109 hashes(1, SBAddFullHash(chunk_id, receive_time, full_hash));
110 return WriteAddHashes(hashes);
111 }
112
113 bool SafeBrowsingStoreSqlite::WriteSubPrefix(int32 chunk_id,
114 int32 add_chunk_id,
115 SBPrefix prefix) {
116 const std::vector<SBSubPrefix>
117 prefixes(1, SBSubPrefix(chunk_id, add_chunk_id, prefix));
118 return WriteSubPrefixes(prefixes);
119 }
120
121 bool SafeBrowsingStoreSqlite::WriteSubHash(int32 chunk_id,
122 int32 add_chunk_id,
123 const SBFullHash& full_hash) {
124 const std::vector<SBSubFullHash>
125 hashes(1, SBSubFullHash(chunk_id, add_chunk_id, full_hash));
126 return WriteSubHashes(hashes);
127 }
128
129 bool SafeBrowsingStoreSqlite::FinishChunk() {
130 return true;
131 }
132
96 bool SafeBrowsingStoreSqlite::OnCorruptDatabase() { 133 bool SafeBrowsingStoreSqlite::OnCorruptDatabase() {
97 if (corruption_callback_.get()) 134 if (corruption_callback_.get())
98 corruption_callback_->Run(); 135 corruption_callback_->Run();
99 return false; 136 return false;
100 } 137 }
101 138
102 bool SafeBrowsingStoreSqlite::Open() { 139 bool SafeBrowsingStoreSqlite::Open() {
103 // This case should never happen, but if it does we shouldn't leak 140 // This case should never happen, but if it does we shouldn't leak
104 // handles. 141 // handles.
105 if (db_) { 142 if (db_) {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // Make sure everything is closed even if DoUpdate() fails. 700 // Make sure everything is closed even if DoUpdate() fails.
664 if (!Close()) 701 if (!Close())
665 return false; 702 return false;
666 703
667 return ret; 704 return ret;
668 } 705 }
669 706
670 bool SafeBrowsingStoreSqlite::CancelUpdate() { 707 bool SafeBrowsingStoreSqlite::CancelUpdate() {
671 return Close(); 708 return Close();
672 } 709 }
710
711 void SafeBrowsingStoreSqlite::SetAddChunk(int32 chunk_id) {
712 add_chunks_cache_.insert(chunk_id);
713 }
714
715 bool SafeBrowsingStoreSqlite::CheckAddChunk(int32 chunk_id) {
716 return add_chunks_cache_.count(chunk_id) > 0;
717 }
718
719 void SafeBrowsingStoreSqlite::GetAddChunks(std::vector<int32>* out) {
720 out->clear();
721 out->insert(out->end(), add_chunks_cache_.begin(), add_chunks_cache_.end());
722 }
723
724 void SafeBrowsingStoreSqlite::SetSubChunk(int32 chunk_id) {
725 sub_chunks_cache_.insert(chunk_id);
726 }
727
728 bool SafeBrowsingStoreSqlite::CheckSubChunk(int32 chunk_id) {
729 return sub_chunks_cache_.count(chunk_id) > 0;
730 }
731
732 void SafeBrowsingStoreSqlite::GetSubChunks(std::vector<int32>* out) {
733 out->clear();
734 out->insert(out->end(), sub_chunks_cache_.begin(), sub_chunks_cache_.end());
735 }
736
737 void SafeBrowsingStoreSqlite::DeleteAddChunk(int32 chunk_id) {
738 add_del_cache_.insert(chunk_id);
739 }
740
741 void SafeBrowsingStoreSqlite::DeleteSubChunk(int32 chunk_id) {
742 sub_del_cache_.insert(chunk_id);
743 }
744
745 // static
746 const FilePath SafeBrowsingStoreSqlite::JournalFileForFilename(
747 const FilePath& filename) {
748 return FilePath(filename.value() + FILE_PATH_LITERAL("-journal"));
749 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store_sqlite.h ('k') | chrome/browser/ssl/ssl_cert_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698