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

Side by Side Diff: content/browser/appcache/appcache_disk_cache.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 "content/browser/appcache/appcache_disk_cache.h" 5 #include "content/browser/appcache/appcache_disk_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 public: 52 public:
53 EntryImpl(disk_cache::Entry* disk_cache_entry, 53 EntryImpl(disk_cache::Entry* disk_cache_entry,
54 AppCacheDiskCache* owner) 54 AppCacheDiskCache* owner)
55 : disk_cache_entry_(disk_cache_entry), owner_(owner) { 55 : disk_cache_entry_(disk_cache_entry), owner_(owner) {
56 DCHECK(disk_cache_entry); 56 DCHECK(disk_cache_entry);
57 DCHECK(owner); 57 DCHECK(owner);
58 owner_->AddOpenEntry(this); 58 owner_->AddOpenEntry(this);
59 } 59 }
60 60
61 // Entry implementation. 61 // Entry implementation.
62 virtual int Read(int index, int64 offset, net::IOBuffer* buf, int buf_len, 62 int Read(int index,
63 const net::CompletionCallback& callback) override { 63 int64 offset,
64 net::IOBuffer* buf,
65 int buf_len,
66 const net::CompletionCallback& callback) override {
64 if (offset < 0 || offset > kint32max) 67 if (offset < 0 || offset > kint32max)
65 return net::ERR_INVALID_ARGUMENT; 68 return net::ERR_INVALID_ARGUMENT;
66 if (!disk_cache_entry_) 69 if (!disk_cache_entry_)
67 return net::ERR_ABORTED; 70 return net::ERR_ABORTED;
68 return disk_cache_entry_->ReadData( 71 return disk_cache_entry_->ReadData(
69 index, static_cast<int>(offset), buf, buf_len, callback); 72 index, static_cast<int>(offset), buf, buf_len, callback);
70 } 73 }
71 74
72 virtual int Write(int index, int64 offset, net::IOBuffer* buf, int buf_len, 75 int Write(int index,
73 const net::CompletionCallback& callback) override { 76 int64 offset,
77 net::IOBuffer* buf,
78 int buf_len,
79 const net::CompletionCallback& callback) override {
74 if (offset < 0 || offset > kint32max) 80 if (offset < 0 || offset > kint32max)
75 return net::ERR_INVALID_ARGUMENT; 81 return net::ERR_INVALID_ARGUMENT;
76 if (!disk_cache_entry_) 82 if (!disk_cache_entry_)
77 return net::ERR_ABORTED; 83 return net::ERR_ABORTED;
78 const bool kTruncate = true; 84 const bool kTruncate = true;
79 return disk_cache_entry_->WriteData( 85 return disk_cache_entry_->WriteData(
80 index, static_cast<int>(offset), buf, buf_len, callback, kTruncate); 86 index, static_cast<int>(offset), buf, buf_len, callback, kTruncate);
81 } 87 }
82 88
83 virtual int64 GetSize(int index) override { 89 int64 GetSize(int index) override {
84 return disk_cache_entry_ ? disk_cache_entry_->GetDataSize(index) : 0L; 90 return disk_cache_entry_ ? disk_cache_entry_->GetDataSize(index) : 0L;
85 } 91 }
86 92
87 virtual void Close() override { 93 void Close() override {
88 if (disk_cache_entry_) 94 if (disk_cache_entry_)
89 disk_cache_entry_->Close(); 95 disk_cache_entry_->Close();
90 delete this; 96 delete this;
91 } 97 }
92 98
93 void Abandon() { 99 void Abandon() {
94 owner_ = NULL; 100 owner_ = NULL;
95 disk_cache_entry_->Close(); 101 disk_cache_entry_->Close();
96 disk_cache_entry_ = NULL; 102 disk_cache_entry_ = NULL;
97 } 103 }
98 104
99 private: 105 private:
100 virtual ~EntryImpl() { 106 ~EntryImpl() override {
101 if (owner_) 107 if (owner_)
102 owner_->RemoveOpenEntry(this); 108 owner_->RemoveOpenEntry(this);
103 } 109 }
104 110
105 disk_cache::Entry* disk_cache_entry_; 111 disk_cache::Entry* disk_cache_entry_;
106 AppCacheDiskCache* owner_; 112 AppCacheDiskCache* owner_;
107 }; 113 };
108 114
109 // Separate object to hold state for each Create, Delete, or Doom call 115 // Separate object to hold state for each Create, Delete, or Doom call
110 // while the call is in-flight and to produce an EntryImpl upon completion. 116 // while the call is in-flight and to produce an EntryImpl upon completion.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 NOTREACHED(); 363 NOTREACHED();
358 break; 364 break;
359 } 365 }
360 if (rv != net::ERR_IO_PENDING) 366 if (rv != net::ERR_IO_PENDING)
361 iter->callback.Run(rv); 367 iter->callback.Run(rv);
362 } 368 }
363 pending_calls_.clear(); 369 pending_calls_.clear();
364 } 370 }
365 371
366 } // namespace content 372 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_disk_cache.h ('k') | content/browser/appcache/appcache_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698