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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_downloader_impl.h

Issue 151133002: libaddressinput - one less copy when downloading data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move ownership of urlfetcher Created 6 years, 10 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 | Annotate | Revision Log
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 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_ 5 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_ 6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 // ::i18n::addressinput::Downloader: 30 // ::i18n::addressinput::Downloader:
31 virtual void Download(const std::string& url, 31 virtual void Download(const std::string& url,
32 scoped_ptr<Callback> downloaded) OVERRIDE; 32 scoped_ptr<Callback> downloaded) OVERRIDE;
33 33
34 // net::URLFetcherDelegate: 34 // net::URLFetcherDelegate:
35 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 35 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
36 36
37 private: 37 private:
38 struct Request { 38 struct Request {
39 Request(const std::string& url, scoped_ptr<Callback> callback); 39 Request(const std::string& url,
40 scoped_ptr<net::URLFetcher> fetcher,
41 scoped_ptr<Callback> callback);
40 42
41 std::string url; 43 std::string url;
44 // The object that manages retrieving the data.
45 scoped_ptr<net::URLFetcher> fetcher;
46 // The data that's received.
47 std::string data;
42 scoped_ptr<Callback> callback; 48 scoped_ptr<Callback> callback;
43 }; 49 };
44 50
45 net::URLRequestContextGetter* const getter_; // weak 51 net::URLRequestContextGetter* const getter_; // weak
46 52
47 // Maps from active url fetcher to request metadata. Both the key and value 53 // Maps from active url fetcher to request metadata. The value is owned.
48 // are owned.
49 std::map<const net::URLFetcher*, Request*> requests_; 54 std::map<const net::URLFetcher*, Request*> requests_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(ChromeDownloaderImpl); 56 DISALLOW_COPY_AND_ASSIGN(ChromeDownloaderImpl);
52 }; 57 };
53 58
54 } // namespace autofill 59 } // namespace autofill
55 60
56 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_ 61 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_DOWNLOADER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698