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

Side by Side Diff: chrome/browser/media_galleries/win/snapshot_file_details.cc

Issue 2792383003: Rename ScopedComPtr::Release() to ScopedComPtr::Reset() (Closed)
Patch Set: Fix New Callers Created 3 years, 8 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/media_galleries/win/snapshot_file_details.h" 5 #include "chrome/browser/media_galleries/win/snapshot_file_details.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 27 matching lines...) Expand all
38 const SnapshotRequestInfo& request_info) 38 const SnapshotRequestInfo& request_info)
39 : request_info_(request_info), 39 : request_info_(request_info),
40 optimal_transfer_size_(0), 40 optimal_transfer_size_(0),
41 bytes_written_(0) { 41 bytes_written_(0) {
42 } 42 }
43 43
44 SnapshotFileDetails::SnapshotFileDetails(const SnapshotFileDetails& other) = 44 SnapshotFileDetails::SnapshotFileDetails(const SnapshotFileDetails& other) =
45 default; 45 default;
46 46
47 SnapshotFileDetails::~SnapshotFileDetails() { 47 SnapshotFileDetails::~SnapshotFileDetails() {
48 file_stream_.Release(); 48 file_stream_.Reset();
49 } 49 }
50 50
51 void SnapshotFileDetails::set_file_info(const base::File::Info& file_info) { 51 void SnapshotFileDetails::set_file_info(const base::File::Info& file_info) {
52 file_info_ = file_info; 52 file_info_ = file_info;
53 } 53 }
54 54
55 void SnapshotFileDetails::set_device_file_stream( 55 void SnapshotFileDetails::set_device_file_stream(
56 IStream* file_stream) { 56 IStream* file_stream) {
57 file_stream_ = file_stream; 57 file_stream_ = file_stream;
58 } 58 }
59 59
60 void SnapshotFileDetails::set_optimal_transfer_size( 60 void SnapshotFileDetails::set_optimal_transfer_size(
61 DWORD optimal_transfer_size) { 61 DWORD optimal_transfer_size) {
62 optimal_transfer_size_ = optimal_transfer_size; 62 optimal_transfer_size_ = optimal_transfer_size;
63 } 63 }
64 64
65 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const { 65 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const {
66 return bytes_written_ == file_info_.size; 66 return bytes_written_ == file_info_.size;
67 } 67 }
68 68
69 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) { 69 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) {
70 if ((bytes_written == 0) || 70 if ((bytes_written == 0) ||
71 (bytes_written_ > std::numeric_limits<uint64_t>::max() - bytes_written) || 71 (bytes_written_ > std::numeric_limits<uint64_t>::max() - bytes_written) ||
72 (bytes_written_ + bytes_written > file_info_.size)) 72 (bytes_written_ + bytes_written > file_info_.size))
73 return false; 73 return false;
74 74
75 bytes_written_ += bytes_written; 75 bytes_written_ += bytes_written;
76 return true; 76 return true;
77 } 77 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/ie_importer_browsertest_win.cc ('k') | chrome/browser/shell_integration_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698