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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_metadata_source.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
« no previous file with comments | « net/url_request/url_fetcher_response_writer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "third_party/libaddressinput/chromium/chrome_metadata_source.h" 5 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 return net::OK; 33 return net::OK;
34 } 34 }
35 35
36 virtual int Write(net::IOBuffer* buffer, 36 virtual int Write(net::IOBuffer* buffer,
37 int num_bytes, 37 int num_bytes,
38 const net::CompletionCallback& callback) override { 38 const net::CompletionCallback& callback) override {
39 data_->append(buffer->data(), num_bytes); 39 data_->append(buffer->data(), num_bytes);
40 return num_bytes; 40 return num_bytes;
41 } 41 }
42 42
43 virtual int Finish(const net::CompletionCallback& callback) override { 43 virtual int Finish(int net_error,
44 const net::CompletionCallback& callback) override {
44 return net::OK; 45 return net::OK;
45 } 46 }
46 47
47 private: 48 private:
48 std::string* data_; // weak reference. 49 std::string* data_; // weak reference.
49 50
50 DISALLOW_COPY_AND_ASSIGN(UnownedStringWriter); 51 DISALLOW_COPY_AND_ASSIGN(UnownedStringWriter);
51 }; 52 };
52 53
53 } // namespace 54 } // namespace
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 104
104 Request* request = new Request(key, std::move(fetcher), downloaded); 105 Request* request = new Request(key, std::move(fetcher), downloaded);
105 request->fetcher->SaveResponseWithWriter( 106 request->fetcher->SaveResponseWithWriter(
106 std::unique_ptr<net::URLFetcherResponseWriter>( 107 std::unique_ptr<net::URLFetcherResponseWriter>(
107 new UnownedStringWriter(&request->data))); 108 new UnownedStringWriter(&request->data)));
108 requests_[request->fetcher.get()] = request; 109 requests_[request->fetcher.get()] = request;
109 request->fetcher->Start(); 110 request->fetcher->Start();
110 } 111 }
111 112
112 } // namespace autofill 113 } // namespace autofill
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher_response_writer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698