OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/indexed_db/indexed_db_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 const GURL& origin_url, | 951 const GURL& origin_url, |
952 const std::string& message) { | 952 const std::string& message) { |
953 const base::FilePath info_path = | 953 const base::FilePath info_path = |
954 path_base.Append(ComputeCorruptionFileName(origin_url)); | 954 path_base.Append(ComputeCorruptionFileName(origin_url)); |
955 if (IsPathTooLong(info_path)) | 955 if (IsPathTooLong(info_path)) |
956 return false; | 956 return false; |
957 | 957 |
958 base::DictionaryValue root_dict; | 958 base::DictionaryValue root_dict; |
959 root_dict.SetString("message", message); | 959 root_dict.SetString("message", message); |
960 std::string output_js; | 960 std::string output_js; |
961 base::JSONWriter::Write(&root_dict, &output_js); | 961 base::JSONWriter::Write(root_dict, &output_js); |
962 | 962 |
963 base::File file(info_path, | 963 base::File file(info_path, |
964 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); | 964 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); |
965 if (!file.IsValid()) | 965 if (!file.IsValid()) |
966 return false; | 966 return false; |
967 int written = file.Write(0, output_js.c_str(), output_js.length()); | 967 int written = file.Write(0, output_js.c_str(), output_js.length()); |
968 return size_t(written) == output_js.length(); | 968 return size_t(written) == output_js.length(); |
969 } | 969 } |
970 | 970 |
971 // static | 971 // static |
(...skipping 3447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4419 | 4419 |
4420 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( | 4420 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( |
4421 const WriteDescriptor& other) = default; | 4421 const WriteDescriptor& other) = default; |
4422 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = | 4422 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = |
4423 default; | 4423 default; |
4424 IndexedDBBackingStore::Transaction::WriteDescriptor& | 4424 IndexedDBBackingStore::Transaction::WriteDescriptor& |
4425 IndexedDBBackingStore::Transaction::WriteDescriptor:: | 4425 IndexedDBBackingStore::Transaction::WriteDescriptor:: |
4426 operator=(const WriteDescriptor& other) = default; | 4426 operator=(const WriteDescriptor& other) = default; |
4427 | 4427 |
4428 } // namespace content | 4428 } // namespace content |
OLD | NEW |