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

Side by Side Diff: components/precache/core/precache_fetcher.cc

Issue 2425673006: Make URLFetcherFileWriter::Finish() skip closing file when there is an error (Closed)
Patch Set: Fix test Created 4 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 // 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 "components/precache/core/precache_fetcher.h" 5 #include "components/precache/core/precache_fetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 int Initialize(const net::CompletionCallback& callback) override { 145 int Initialize(const net::CompletionCallback& callback) override {
146 return net::OK; 146 return net::OK;
147 } 147 }
148 148
149 int Write(net::IOBuffer* buffer, 149 int Write(net::IOBuffer* buffer,
150 int num_bytes, 150 int num_bytes,
151 const net::CompletionCallback& callback) override { 151 const net::CompletionCallback& callback) override {
152 return num_bytes; 152 return num_bytes;
153 } 153 }
154 154
155 int Finish(const net::CompletionCallback& callback) override { 155 int Finish(int net_error, const net::CompletionCallback& callback) override {
156 return net::OK; 156 return net::OK;
157 } 157 }
158 }; 158 };
159 159
160 // Returns the base64 encoded resource URL hashes. The resource URLs are hashed 160 // Returns the base64 encoded resource URL hashes. The resource URLs are hashed
161 // individually, and 8 bytes of each hash is appended together, which is then 161 // individually, and 8 bytes of each hash is appended together, which is then
162 // encoded to base64. 162 // encoded to base64.
163 std::string GetResourceURLBase64Hash(const std::vector<GURL>& urls) { 163 std::string GetResourceURLBase64Hash(const std::vector<GURL>& urls) {
164 // Each resource hash uses 8 bytes, instead of the 20 bytes of sha1 hash, as a 164 // Each resource hash uses 8 bytes, instead of the 20 bytes of sha1 hash, as a
165 // tradeoff between sending more bytes and reducing hash collisions. 165 // tradeoff between sending more bytes and reducing hash collisions.
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 remaining = 0; 764 remaining = 0;
765 quota_.set_remaining( 765 quota_.set_remaining(
766 used_bytes > quota_.remaining() ? 0U : quota_.remaining() - used_bytes); 766 used_bytes > quota_.remaining() ? 0U : quota_.remaining() - used_bytes);
767 db_task_runner_->PostTask( 767 db_task_runner_->PostTask(
768 FROM_HERE, 768 FROM_HERE,
769 base::Bind(&PrecacheDatabase::SaveQuota, precache_database_, quota_)); 769 base::Bind(&PrecacheDatabase::SaveQuota, precache_database_, quota_));
770 } 770 }
771 } 771 }
772 772
773 } // namespace precache 773 } // namespace precache
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.cc ('k') | content/shell/browser/shell_devtools_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698