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

Side by Side Diff: net/disk_cache/file_posix.cc

Issue 10825437: net: Fix more clang warnings about missing virtual and OVERRIDE annotations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/sparse_control.cc » ('j') | 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 "net/disk_cache/file.h" 5 #include "net/disk_cache/file.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 // Read and Write are the operations that can be performed asynchronously. 43 // Read and Write are the operations that can be performed asynchronously.
44 // The actual parameters for the operation are setup in the constructor of 44 // The actual parameters for the operation are setup in the constructor of
45 // the object. Both methods should be called from a worker thread, by posting 45 // the object. Both methods should be called from a worker thread, by posting
46 // a task to the WorkerPool (they are RunnableMethods). When finished, 46 // a task to the WorkerPool (they are RunnableMethods). When finished,
47 // controller->OnIOComplete() is called. 47 // controller->OnIOComplete() is called.
48 void Read(); 48 void Read();
49 void Write(); 49 void Write();
50 50
51 private: 51 private:
52 ~FileBackgroundIO() {} 52 virtual ~FileBackgroundIO() {}
53 53
54 disk_cache::FileIOCallback* callback_; 54 disk_cache::FileIOCallback* callback_;
55 55
56 disk_cache::File* file_; 56 disk_cache::File* file_;
57 const void* buf_; 57 const void* buf_;
58 size_t buf_len_; 58 size_t buf_len_;
59 size_t offset_; 59 size_t offset_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(FileBackgroundIO); 61 DISALLOW_COPY_AND_ASSIGN(FileBackgroundIO);
62 }; 62 };
63 63
64 64
65 // The specialized controller that keeps track of current operations. 65 // The specialized controller that keeps track of current operations.
66 class FileInFlightIO : public disk_cache::InFlightIO { 66 class FileInFlightIO : public disk_cache::InFlightIO {
67 public: 67 public:
68 FileInFlightIO() {} 68 FileInFlightIO() {}
69 ~FileInFlightIO() {} 69 virtual ~FileInFlightIO() {}
70 70
71 // These methods start an asynchronous operation. The arguments have the same 71 // These methods start an asynchronous operation. The arguments have the same
72 // semantics of the File asynchronous operations, with the exception that the 72 // semantics of the File asynchronous operations, with the exception that the
73 // operation never finishes synchronously. 73 // operation never finishes synchronously.
74 void PostRead(disk_cache::File* file, void* buf, size_t buf_len, 74 void PostRead(disk_cache::File* file, void* buf, size_t buf_len,
75 size_t offset, disk_cache::FileIOCallback* callback); 75 size_t offset, disk_cache::FileIOCallback* callback);
76 void PostWrite(disk_cache::File* file, const void* buf, size_t buf_len, 76 void PostWrite(disk_cache::File* file, const void* buf, size_t buf_len,
77 size_t offset, disk_cache::FileIOCallback* callback); 77 size_t offset, disk_cache::FileIOCallback* callback);
78 78
79 protected: 79 protected:
80 // Invokes the users' completion callback at the end of the IO operation. 80 // Invokes the users' completion callback at the end of the IO operation.
81 // |cancel| is true if the actual task posted to the thread is still 81 // |cancel| is true if the actual task posted to the thread is still
82 // queued (because we are inside WaitForPendingIO), and false if said task is 82 // queued (because we are inside WaitForPendingIO), and false if said task is
83 // the one performing the call. 83 // the one performing the call.
84 virtual void OnOperationComplete(disk_cache::BackgroundIO* operation, 84 virtual void OnOperationComplete(disk_cache::BackgroundIO* operation,
85 bool cancel); 85 bool cancel) OVERRIDE;
86 86
87 private: 87 private:
88 DISALLOW_COPY_AND_ASSIGN(FileInFlightIO); 88 DISALLOW_COPY_AND_ASSIGN(FileInFlightIO);
89 }; 89 };
90 90
91 // --------------------------------------------------------------------------- 91 // ---------------------------------------------------------------------------
92 92
93 // Runs on a worker thread. 93 // Runs on a worker thread.
94 void FileBackgroundIO::Read() { 94 void FileBackgroundIO::Read() {
95 if (file_->Read(const_cast<void*>(buf_), buf_len_, offset_)) { 95 if (file_->Read(const_cast<void*>(buf_), buf_len_, offset_)) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return false; 300 return false;
301 301
302 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback); 302 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback);
303 303
304 if (completed) 304 if (completed)
305 *completed = false; 305 *completed = false;
306 return true; 306 return true;
307 } 307 }
308 308
309 } // namespace disk_cache 309 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/sparse_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698