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

Side by Side Diff: util/file/file_reader.cc

Issue 982613002: handler: Add report upload (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 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
« no previous file with comments | « util/file/file_reader.h ('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 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 FileReader::FileReader() 64 FileReader::FileReader()
65 : file_(), 65 : file_(),
66 weak_file_handle_file_reader_(kInvalidFileHandle) { 66 weak_file_handle_file_reader_(kInvalidFileHandle) {
67 } 67 }
68 68
69 FileReader::~FileReader() { 69 FileReader::~FileReader() {
70 } 70 }
71 71
72 bool FileReader::Open(const base::FilePath& path, 72 bool FileReader::Open(const base::FilePath& path) {
73 FileWriteMode write_mode,
74 FilePermissions permissions) {
75 CHECK(!file_.is_valid()); 73 CHECK(!file_.is_valid());
76 file_.reset(LoggingOpenFileForRead(path)); 74 file_.reset(LoggingOpenFileForRead(path));
77 if (!file_.is_valid()) { 75 if (!file_.is_valid()) {
78 return false; 76 return false;
79 } 77 }
80 78
81 weak_file_handle_file_reader_.set_file_handle(file_.get()); 79 weak_file_handle_file_reader_.set_file_handle(file_.get());
82 return true; 80 return true;
83 } 81 }
84 82
85 void FileReader::Close() { 83 void FileReader::Close() {
86 CHECK(file_.is_valid()); 84 CHECK(file_.is_valid());
87 85
88 weak_file_handle_file_reader_.set_file_handle(kInvalidFileHandle); 86 weak_file_handle_file_reader_.set_file_handle(kInvalidFileHandle);
89 file_.reset(); 87 file_.reset();
90 } 88 }
91 89
92 ssize_t FileReader::Read(void* data, size_t size) { 90 ssize_t FileReader::Read(void* data, size_t size) {
93 DCHECK(file_.is_valid()); 91 DCHECK(file_.is_valid());
94 return weak_file_handle_file_reader_.Read(data, size); 92 return weak_file_handle_file_reader_.Read(data, size);
95 } 93 }
96 94
97 FileOffset FileReader::Seek(FileOffset offset, int whence) { 95 FileOffset FileReader::Seek(FileOffset offset, int whence) {
98 DCHECK(file_.is_valid()); 96 DCHECK(file_.is_valid());
99 return weak_file_handle_file_reader_.Seek(offset, whence); 97 return weak_file_handle_file_reader_.Seek(offset, whence);
100 } 98 }
101 99
102 } // namespace crashpad 100 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/file/file_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698