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

Side by Side Diff: net/base/file_stream.h

Issue 7583049: Record UMA statistics for file_stream operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Posix compile error. Created 9 years, 4 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file defines FileStream, a basic interface for reading and writing files 5 // This file defines FileStream, a basic interface for reading and writing files
6 // synchronously or asynchronously with support for seeking to an offset. 6 // synchronously or asynchronously with support for seeking to an offset.
7 // Note that even when used asynchronously, only one operation is supported at 7 // Note that even when used asynchronously, only one operation is supported at
8 // a time. 8 // a time.
9 9
10 #ifndef NET_BASE_FILE_STREAM_H_ 10 #ifndef NET_BASE_FILE_STREAM_H_
11 #define NET_BASE_FILE_STREAM_H_ 11 #define NET_BASE_FILE_STREAM_H_
12 #pragma once 12 #pragma once
13 13
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
17 #include "net/base/file_stream_metrics.h"
cbentzel 2011/08/18 13:31:28 This include isn't needed.
ahendrickson 2011/08/18 15:56:45 Done.
17 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
18 19
19 class FilePath; 20 class FilePath;
20 21
21 namespace net { 22 namespace net {
22 23
23 // TODO(darin): Move this to a more generic location. 24 // TODO(darin): Move this to a more generic location.
24 // This explicit mapping matches both FILE_ on Windows and SEEK_ on Linux. 25 // This explicit mapping matches both FILE_ on Windows and SEEK_ on Linux.
25 enum Whence { 26 enum Whence {
26 FROM_BEGIN = 0, 27 FROM_BEGIN = 0,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Forces out a filesystem sync on this file to make sure that the file was 126 // Forces out a filesystem sync on this file to make sure that the file was
126 // written out to disk and is not currently sitting in the buffer. This does 127 // written out to disk and is not currently sitting in the buffer. This does
127 // not have to be called, it just forces one to happen at the time of 128 // not have to be called, it just forces one to happen at the time of
128 // calling. 129 // calling.
129 // 130 //
130 /// Returns an error code if the operation could not be performed. 131 /// Returns an error code if the operation could not be performed.
131 // 132 //
132 // This method should not be called if the stream was opened READ_ONLY. 133 // This method should not be called if the stream was opened READ_ONLY.
133 int Flush(); 134 int Flush();
134 135
136 // Turns on UMA error statistics gathering.
137 void EnableErrorStatistics();
138
135 private: 139 private:
136 class AsyncContext; 140 class AsyncContext;
137 friend class AsyncContext; 141 friend class AsyncContext;
138 142
143 int RecordAndMapError(int error, FileErrorSource source);
cbentzel 2011/08/18 13:31:28 This doesn't need to be a member function. It can
ahendrickson 2011/08/18 15:56:45 Done.
144
139 // This member is used to support asynchronous reads. It is non-null when 145 // This member is used to support asynchronous reads. It is non-null when
140 // the FileStream was opened with PLATFORM_FILE_ASYNC. 146 // the FileStream was opened with PLATFORM_FILE_ASYNC.
141 scoped_ptr<AsyncContext> async_context_; 147 scoped_ptr<AsyncContext> async_context_;
142 148
143 base::PlatformFile file_; 149 base::PlatformFile file_;
144 int open_flags_; 150 int open_flags_;
145 bool auto_closed_; 151 bool auto_closed_;
152 bool record_uma_;
146 153
147 DISALLOW_COPY_AND_ASSIGN(FileStream); 154 DISALLOW_COPY_AND_ASSIGN(FileStream);
148 }; 155 };
149 156
150 } // namespace net 157 } // namespace net
151 158
152 #endif // NET_BASE_FILE_STREAM_H_ 159 #endif // NET_BASE_FILE_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698