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

Side by Side Diff: chrome/browser/safe_browsing/two_phase_uploader.h

Issue 2851083002: Bind TwoPhaseUploader to a sequence, not a thread.
Patch Set: Created 3 years, 7 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 | « no previous file | chrome/browser/safe_browsing/two_phase_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 int response_code, 48 int response_code,
49 const std::string& response_data)>; 49 const std::string& response_data)>;
50 50
51 virtual ~TwoPhaseUploader() {} 51 virtual ~TwoPhaseUploader() {}
52 52
53 // Create the uploader. The Start method must be called to begin the upload. 53 // Create the uploader. The Start method must be called to begin the upload.
54 // Network processing will use |url_request_context_getter|. 54 // Network processing will use |url_request_context_getter|.
55 // The uploaded |file_path| will be read on |file_task_runner|. 55 // The uploaded |file_path| will be read on |file_task_runner|.
56 // The first phase request will be sent to |base_url|, with |metadata| 56 // The first phase request will be sent to |base_url|, with |metadata|
57 // included. 57 // included.
58 // |progress_callback| will be called periodically as the second phase 58 // |progress_callback| will be called periodically on the same sequence Start
59 // progresses, if it is non-null. 59 // was called on as the second phase progresses, if it is non-null.
60 // On success |finish_callback| will be called with state = STATE_SUCCESS and 60 // On success |finish_callback| will be called on the same sequence Start was
61 // the server response in response_data. On failure, state will specify 61 // called on, with state = STATE_SUCCESS and the server response in
62 // which step the failure occurred in, and net_error, response_code, and 62 // response_data. On failure, state will specify which step the failure
63 // response_data will specify information about the error. |finish_callback| 63 // occurred in, and net_error, response_code, and response_data will specify
64 // will not be called if the upload is cancelled by destructing the 64 // information about the error. |finish_callback| will not be called if the
65 // TwoPhaseUploader object before completion. 65 // upload is cancelled by destructing the TwoPhaseUploader object before
66 // completion.
66 static std::unique_ptr<TwoPhaseUploader> Create( 67 static std::unique_ptr<TwoPhaseUploader> Create(
67 net::URLRequestContextGetter* url_request_context_getter, 68 net::URLRequestContextGetter* url_request_context_getter,
68 base::TaskRunner* file_task_runner, 69 base::TaskRunner* file_task_runner,
69 const GURL& base_url, 70 const GURL& base_url,
70 const std::string& metadata, 71 const std::string& metadata,
71 const base::FilePath& file_path, 72 const base::FilePath& file_path,
72 const ProgressCallback& progress_callback, 73 const ProgressCallback& progress_callback,
73 const FinishCallback& finish_callback, 74 const FinishCallback& finish_callback,
74 const net::NetworkTrafficAnnotationTag& traffic_annotation); 75 const net::NetworkTrafficAnnotationTag& traffic_annotation);
75 76
(...skipping 21 matching lines...) Expand all
97 base::TaskRunner* file_task_runner, 98 base::TaskRunner* file_task_runner,
98 const GURL& base_url, 99 const GURL& base_url,
99 const std::string& metadata, 100 const std::string& metadata,
100 const base::FilePath& file_path, 101 const base::FilePath& file_path,
101 const TwoPhaseUploader::ProgressCallback& progress_callback, 102 const TwoPhaseUploader::ProgressCallback& progress_callback,
102 const TwoPhaseUploader::FinishCallback& finish_callback, 103 const TwoPhaseUploader::FinishCallback& finish_callback,
103 const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0; 104 const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0;
104 }; 105 };
105 106
106 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ 107 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/two_phase_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698