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

Side by Side Diff: storage/browser/fileapi/sandbox_prioritized_origin_database.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "storage/browser/fileapi/sandbox_prioritized_origin_database.h" 5 #include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 12 matching lines...) Expand all
23 23
24 namespace { 24 namespace {
25 25
26 bool WritePrimaryOriginFile(const base::FilePath& path, 26 bool WritePrimaryOriginFile(const base::FilePath& path,
27 const std::string& origin) { 27 const std::string& origin) {
28 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE); 28 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
29 if (!file.IsValid()) 29 if (!file.IsValid())
30 return false; 30 return false;
31 if (!file.created()) 31 if (!file.created())
32 file.SetLength(0); 32 file.SetLength(0);
33 Pickle pickle; 33 base::Pickle pickle;
34 pickle.WriteString(origin); 34 pickle.WriteString(origin);
35 file.Write(0, static_cast<const char*>(pickle.data()), pickle.size()); 35 file.Write(0, static_cast<const char*>(pickle.data()), pickle.size());
36 file.Flush(); 36 file.Flush();
37 return true; 37 return true;
38 } 38 }
39 39
40 bool ReadPrimaryOriginFile(const base::FilePath& path, 40 bool ReadPrimaryOriginFile(const base::FilePath& path,
41 std::string* origin) { 41 std::string* origin) {
42 std::string buffer; 42 std::string buffer;
43 if (!base::ReadFileToString(path, &buffer)) 43 if (!base::ReadFileToString(path, &buffer))
44 return false; 44 return false;
45 Pickle pickle(buffer.data(), buffer.size()); 45 base::Pickle pickle(buffer.data(), buffer.size());
46 PickleIterator iter(pickle); 46 base::PickleIterator iter(pickle);
47 return iter.ReadString(origin) && !origin->empty(); 47 return iter.ReadString(origin) && !origin->empty();
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 SandboxPrioritizedOriginDatabase::SandboxPrioritizedOriginDatabase( 52 SandboxPrioritizedOriginDatabase::SandboxPrioritizedOriginDatabase(
53 const base::FilePath& file_system_directory, 53 const base::FilePath& file_system_directory,
54 leveldb::Env* env_override) 54 leveldb::Env* env_override)
55 : file_system_directory_(file_system_directory), 55 : file_system_directory_(file_system_directory),
56 env_override_(env_override), 56 env_override_(env_override),
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 } 217 }
218 218
219 SandboxOriginDatabase* 219 SandboxOriginDatabase*
220 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() { 220 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() {
221 MaybeInitializeNonPrimaryDatabase(true); 221 MaybeInitializeNonPrimaryDatabase(true);
222 return origin_database_.get(); 222 return origin_database_.get();
223 } 223 }
224 224
225 } // namespace storage 225 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/sandbox_directory_database.cc ('k') | third_party/mojo/src/mojo/edk/system/message_pipe_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698