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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/operation.cc

Issue 2756393002: Deflake ImageWriterUtilityClient browsertest and clients (Closed)
Patch Set: Remove progress case from Cancel test. Created 3 years, 9 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 "chrome/browser/extensions/api/image_writer_private/operation.h" 5 #include "chrome/browser/extensions/api/image_writer_private/operation.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 256 return;
257 } 257 }
258 if (!image_writer_client_.get()) { 258 if (!image_writer_client_.get()) {
259 image_writer_client_ = new ImageWriterUtilityClient(); 259 image_writer_client_ = new ImageWriterUtilityClient();
260 AddCleanUpFunction(base::Bind(&Operation::StopUtilityClient, this)); 260 AddCleanUpFunction(base::Bind(&Operation::StopUtilityClient, this));
261 } 261 }
262 } 262 }
263 263
264 void Operation::StopUtilityClient() { 264 void Operation::StopUtilityClient() {
265 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 265 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
266 BrowserThread::PostTask( 266 image_writer_client_->Shutdown();
267 BrowserThread::IO,
268 FROM_HERE,
269 base::Bind(&ImageWriterUtilityClient::Shutdown, image_writer_client_));
270 } 267 }
271 268
272 void Operation::WriteImageProgress(int64_t total_bytes, int64_t curr_bytes) { 269 void Operation::WriteImageProgress(int64_t total_bytes, int64_t curr_bytes) {
273 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 270 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
274 if (IsCancelled()) { 271 if (IsCancelled()) {
275 return; 272 return;
276 } 273 }
277 274
278 int progress = kProgressComplete * curr_bytes / total_bytes; 275 int progress = kProgressComplete * curr_bytes / total_bytes;
279 276
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin(); 375 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin();
379 it != cleanup_functions_.end(); 376 it != cleanup_functions_.end();
380 ++it) { 377 ++it) {
381 it->Run(); 378 it->Run();
382 } 379 }
383 cleanup_functions_.clear(); 380 cleanup_functions_.clear();
384 } 381 }
385 382
386 } // namespace image_writer 383 } // namespace image_writer
387 } // namespace extensions 384 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698