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

Side by Side Diff: components/drive/drive_uploader.cc

Issue 1999953002: Move content/browser/power_save_blocker to //device/power_save_blocker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@power-save-next-2
Patch Set: . Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drive/drive_uploader.h" 5 #include "components/drive/drive_uploader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const std::string& content_type, 92 const std::string& content_type,
93 const UploadCompletionCallback& callback, 93 const UploadCompletionCallback& callback,
94 const ProgressCallback& progress_callback) 94 const ProgressCallback& progress_callback)
95 : file_path(local_path), 95 : file_path(local_path),
96 content_type(content_type), 96 content_type(content_type),
97 completion_callback(callback), 97 completion_callback(callback),
98 progress_callback(progress_callback), 98 progress_callback(progress_callback),
99 content_length(0), 99 content_length(0),
100 next_start_position(-1), 100 next_start_position(-1),
101 power_save_blocker(content::CreatePowerSaveBlocker( 101 power_save_blocker(content::CreatePowerSaveBlocker(
102 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 102 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
103 content::PowerSaveBlocker::kReasonOther, 103 device::PowerSaveBlocker::kReasonOther,
104 "Upload in progress")), 104 "Upload in progress")),
105 cancelled(false), 105 cancelled(false),
106 weak_ptr_factory_(this) {} 106 weak_ptr_factory_(this) {}
107 107
108 ~UploadFileInfo() { 108 ~UploadFileInfo() {
109 } 109 }
110 110
111 // Useful for printf debugging. 111 // Useful for printf debugging.
112 std::string DebugString() const { 112 std::string DebugString() const {
113 return "file_path=[" + file_path.AsUTF8Unsafe() + 113 return "file_path=[" + file_path.AsUTF8Unsafe() +
(...skipping 22 matching lines...) Expand all
136 // Location URL where file is to be uploaded to, returned from 136 // Location URL where file is to be uploaded to, returned from
137 // InitiateUpload. Used for the subsequent ResumeUpload requests. 137 // InitiateUpload. Used for the subsequent ResumeUpload requests.
138 GURL upload_location; 138 GURL upload_location;
139 139
140 // Header content-Length. 140 // Header content-Length.
141 int64_t content_length; 141 int64_t content_length;
142 142
143 int64_t next_start_position; 143 int64_t next_start_position;
144 144
145 // Blocks system suspend while upload is in progress. 145 // Blocks system suspend while upload is in progress.
146 std::unique_ptr<content::PowerSaveBlocker> power_save_blocker; 146 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker;
147 147
148 // Fields for implementing cancellation. |cancel_callback| is non-null if 148 // Fields for implementing cancellation. |cancel_callback| is non-null if
149 // there is an in-flight HTTP request. In that case, |cancell_callback| will 149 // there is an in-flight HTTP request. In that case, |cancell_callback| will
150 // cancel the operation. |cancelled| is initially false and turns to true 150 // cancel the operation. |cancelled| is initially false and turns to true
151 // once Cancel() is called. DriveUploader will check this field before after 151 // once Cancel() is called. DriveUploader will check this field before after
152 // an async task other than HTTP requests and cancels the subsequent requests 152 // an async task other than HTTP requests and cancels the subsequent requests
153 // if this is flagged to true. 153 // if this is flagged to true.
154 CancelCallback cancel_callback; 154 CancelCallback cancel_callback;
155 bool cancelled; 155 bool cancelled;
156 156
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); 528 DVLOG(1) << "Upload failed " << upload_file_info->DebugString();
529 if (error == HTTP_PRECONDITION) 529 if (error == HTTP_PRECONDITION)
530 error = HTTP_CONFLICT; // ETag mismatch. 530 error = HTTP_CONFLICT; // ETag mismatch.
531 upload_file_info->completion_callback.Run(error, 531 upload_file_info->completion_callback.Run(error,
532 upload_file_info->upload_location, 532 upload_file_info->upload_location,
533 std::unique_ptr<FileResource>()); 533 std::unique_ptr<FileResource>());
534 } 534 }
535 } 535 }
536 536
537 } // namespace drive 537 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698