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

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

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 8
9 /////////////////////////////////////////////////////////////////////////////// 9 ///////////////////////////////////////////////////////////////////////////////
10 // SnapshotRequestInfo // 10 // SnapshotRequestInfo //
(...skipping 19 matching lines...) Expand all
30 const SnapshotRequestInfo& request_info) 30 const SnapshotRequestInfo& request_info)
31 : request_info_(request_info), 31 : request_info_(request_info),
32 optimal_transfer_size_(0), 32 optimal_transfer_size_(0),
33 bytes_written_(0) { 33 bytes_written_(0) {
34 } 34 }
35 35
36 SnapshotFileDetails::~SnapshotFileDetails() { 36 SnapshotFileDetails::~SnapshotFileDetails() {
37 file_stream_.Release(); 37 file_stream_.Release();
38 } 38 }
39 39
40 void SnapshotFileDetails::set_file_info( 40 void SnapshotFileDetails::set_file_info(const base::File::Info& file_info) {
41 const base::PlatformFileInfo& file_info) {
42 file_info_ = file_info; 41 file_info_ = file_info;
43 } 42 }
44 43
45 void SnapshotFileDetails::set_device_file_stream( 44 void SnapshotFileDetails::set_device_file_stream(
46 IStream* file_stream) { 45 IStream* file_stream) {
47 file_stream_ = file_stream; 46 file_stream_ = file_stream;
48 } 47 }
49 48
50 void SnapshotFileDetails::set_optimal_transfer_size( 49 void SnapshotFileDetails::set_optimal_transfer_size(
51 DWORD optimal_transfer_size) { 50 DWORD optimal_transfer_size) {
52 optimal_transfer_size_ = optimal_transfer_size; 51 optimal_transfer_size_ = optimal_transfer_size;
53 } 52 }
54 53
55 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const { 54 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const {
56 return bytes_written_ == file_info_.size; 55 return bytes_written_ == file_info_.size;
57 } 56 }
58 57
59 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) { 58 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) {
60 if ((bytes_written == 0) || 59 if ((bytes_written == 0) ||
61 (bytes_written_ > kuint64max - bytes_written) || 60 (bytes_written_ > kuint64max - bytes_written) ||
62 (bytes_written_ + bytes_written > file_info_.size)) 61 (bytes_written_ + bytes_written > file_info_.size))
63 return false; 62 return false;
64 63
65 bytes_written_ += bytes_written; 64 bytes_written_ += bytes_written;
66 return true; 65 return true;
67 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/win/snapshot_file_details.h ('k') | chrome/browser/storage_monitor/image_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698