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

Side by Side Diff: third_party/zlib/google/zip_reader.cc

Issue 1550693002: Global conversion of Pass()→std::move() on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « third_party/libaddressinput/chromium/json.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 (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 "third_party/zlib/google/zip_reader.h" 5 #include "third_party/zlib/google/zip_reader.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file.h" 10 #include "base/files/file.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
14 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
15 #include "build/build_config.h" 17 #include "build/build_config.h"
16 #include "third_party/zlib/google/zip_internal.h" 18 #include "third_party/zlib/google/zip_internal.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 389
388 if (!output_file.IsValid()) { 390 if (!output_file.IsValid()) {
389 DVLOG(1) << "Unzip failed: unable to create platform file at " 391 DVLOG(1) << "Unzip failed: unable to create platform file at "
390 << output_file_path.value(); 392 << output_file_path.value();
391 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback); 393 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback);
392 return; 394 return;
393 } 395 }
394 396
395 base::MessageLoop::current()->PostTask( 397 base::MessageLoop::current()->PostTask(
396 FROM_HERE, 398 FROM_HERE,
397 base::Bind(&ZipReader::ExtractChunk, 399 base::Bind(&ZipReader::ExtractChunk, weak_ptr_factory_.GetWeakPtr(),
398 weak_ptr_factory_.GetWeakPtr(), 400 Passed(std::move(output_file)), success_callback,
399 Passed(output_file.Pass()), 401 failure_callback, progress_callback, 0 /* initial offset */));
400 success_callback,
401 failure_callback,
402 progress_callback,
403 0 /* initial offset */));
404 } 402 }
405 403
406 bool ZipReader::ExtractCurrentEntryIntoDirectory( 404 bool ZipReader::ExtractCurrentEntryIntoDirectory(
407 const base::FilePath& output_directory_path) const { 405 const base::FilePath& output_directory_path) const {
408 DCHECK(current_entry_info_.get()); 406 DCHECK(current_entry_info_.get());
409 407
410 base::FilePath output_file_path = output_directory_path.Append( 408 base::FilePath output_file_path = output_directory_path.Append(
411 current_entry_info()->file_path()); 409 current_entry_info()->file_path());
412 return ExtractCurrentEntryToFilePath(output_file_path); 410 return ExtractCurrentEntryToFilePath(output_file_path);
413 } 411 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 failure_callback.Run(); 496 failure_callback.Run();
499 return; 497 return;
500 } 498 }
501 499
502 int64_t current_progress = offset + num_bytes_read; 500 int64_t current_progress = offset + num_bytes_read;
503 501
504 progress_callback.Run(current_progress); 502 progress_callback.Run(current_progress);
505 503
506 base::MessageLoop::current()->PostTask( 504 base::MessageLoop::current()->PostTask(
507 FROM_HERE, 505 FROM_HERE,
508 base::Bind(&ZipReader::ExtractChunk, 506 base::Bind(&ZipReader::ExtractChunk, weak_ptr_factory_.GetWeakPtr(),
509 weak_ptr_factory_.GetWeakPtr(), 507 Passed(std::move(output_file)), success_callback,
510 Passed(output_file.Pass()), 508 failure_callback, progress_callback, current_progress));
511 success_callback,
512 failure_callback,
513 progress_callback,
514 current_progress));
515
516 } 509 }
517 } 510 }
518 511
519 // FileWriterDelegate ---------------------------------------------------------- 512 // FileWriterDelegate ----------------------------------------------------------
520 513
521 FileWriterDelegate::FileWriterDelegate(base::File* file) 514 FileWriterDelegate::FileWriterDelegate(base::File* file)
522 : file_(file), 515 : file_(file),
523 file_length_(0) { 516 file_length_(0) {
524 } 517 }
525 518
(...skipping 10 matching lines...) Expand all
536 } 529 }
537 530
538 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) { 531 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) {
539 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes); 532 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes);
540 if (bytes_written > 0) 533 if (bytes_written > 0)
541 file_length_ += bytes_written; 534 file_length_ += bytes_written;
542 return bytes_written == num_bytes; 535 return bytes_written == num_bytes;
543 } 536 }
544 537
545 } // namespace zip 538 } // namespace zip
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/json.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698