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

Side by Side Diff: content/renderer/dom_storage/dom_storage_dispatcher.cc

Issue 670683003: Standardize usage of virtual/override/final in content/renderer/ (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/renderer/dom_storage/dom_storage_dispatcher.h" 5 #include "content/renderer/dom_storage/dom_storage_dispatcher.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 21 matching lines...) Expand all
32 // observes receipt of the acks on the IPC thread to decrement a counter. 32 // observes receipt of the acks on the IPC thread to decrement a counter.
33 class MessageThrottlingFilter : public IPC::MessageFilter { 33 class MessageThrottlingFilter : public IPC::MessageFilter {
34 public: 34 public:
35 explicit MessageThrottlingFilter(RenderThreadImpl* sender) 35 explicit MessageThrottlingFilter(RenderThreadImpl* sender)
36 : pending_count_(0), sender_(sender) {} 36 : pending_count_(0), sender_(sender) {}
37 37
38 void SendThrottled(IPC::Message* message); 38 void SendThrottled(IPC::Message* message);
39 void Shutdown() { sender_ = NULL; } 39 void Shutdown() { sender_ = NULL; }
40 40
41 private: 41 private:
42 virtual ~MessageThrottlingFilter() {} 42 ~MessageThrottlingFilter() override {}
43 43
44 virtual bool OnMessageReceived(const IPC::Message& message) override; 44 bool OnMessageReceived(const IPC::Message& message) override;
45 45
46 int GetPendingCount() { return IncrementPendingCountN(0); } 46 int GetPendingCount() { return IncrementPendingCountN(0); }
47 int IncrementPendingCount() { return IncrementPendingCountN(1); } 47 int IncrementPendingCount() { return IncrementPendingCountN(1); }
48 int DecrementPendingCount() { return IncrementPendingCountN(-1); } 48 int DecrementPendingCount() { return IncrementPendingCountN(-1); }
49 int IncrementPendingCountN(int increment) { 49 int IncrementPendingCountN(int increment) {
50 base::AutoLock locker(lock_); 50 base::AutoLock locker(lock_);
51 pending_count_ += increment; 51 pending_count_ += increment;
52 return pending_count_; 52 return pending_count_;
53 } 53 }
54 54
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DOMStorageCachedArea* OpenCachedArea( 102 DOMStorageCachedArea* OpenCachedArea(
103 int64 namespace_id, const GURL& origin); 103 int64 namespace_id, const GURL& origin);
104 void CloseCachedArea(DOMStorageCachedArea* area); 104 void CloseCachedArea(DOMStorageCachedArea* area);
105 DOMStorageCachedArea* LookupCachedArea( 105 DOMStorageCachedArea* LookupCachedArea(
106 int64 namespace_id, const GURL& origin); 106 int64 namespace_id, const GURL& origin);
107 void ResetAllCachedAreas(int64 namespace_id); 107 void ResetAllCachedAreas(int64 namespace_id);
108 void CompleteOnePendingCallback(bool success); 108 void CompleteOnePendingCallback(bool success);
109 void Shutdown(); 109 void Shutdown();
110 110
111 // DOMStorageProxy interface for use by DOMStorageCachedArea. 111 // DOMStorageProxy interface for use by DOMStorageCachedArea.
112 virtual void LoadArea(int connection_id, DOMStorageValuesMap* values, 112 void LoadArea(int connection_id,
113 bool* send_log_get_messages, 113 DOMStorageValuesMap* values,
114 const CompletionCallback& callback) override; 114 bool* send_log_get_messages,
115 virtual void SetItem(int connection_id, const base::string16& key, 115 const CompletionCallback& callback) override;
116 const base::string16& value, const GURL& page_url, 116 void SetItem(int connection_id,
117 const CompletionCallback& callback) override; 117 const base::string16& key,
118 virtual void LogGetItem(int connection_id, const base::string16& key, 118 const base::string16& value,
119 const base::NullableString16& value) override; 119 const GURL& page_url,
120 virtual void RemoveItem(int connection_id, const base::string16& key, 120 const CompletionCallback& callback) override;
121 const GURL& page_url, 121 void LogGetItem(int connection_id,
122 const CompletionCallback& callback) override; 122 const base::string16& key,
123 virtual void ClearArea(int connection_id, 123 const base::NullableString16& value) override;
124 const GURL& page_url, 124 void RemoveItem(int connection_id,
125 const CompletionCallback& callback) override; 125 const base::string16& key,
126 const GURL& page_url,
127 const CompletionCallback& callback) override;
128 void ClearArea(int connection_id,
129 const GURL& page_url,
130 const CompletionCallback& callback) override;
126 131
127 private: 132 private:
128 // Struct to hold references to our contained areas and 133 // Struct to hold references to our contained areas and
129 // to keep track of how many tabs have a given area open. 134 // to keep track of how many tabs have a given area open.
130 struct CachedAreaHolder { 135 struct CachedAreaHolder {
131 scoped_refptr<DOMStorageCachedArea> area_; 136 scoped_refptr<DOMStorageCachedArea> area_;
132 int open_count_; 137 int open_count_;
133 int64 namespace_id_; 138 int64 namespace_id_;
134 CachedAreaHolder() : open_count_(0) {} 139 CachedAreaHolder() : open_count_(0) {}
135 CachedAreaHolder(DOMStorageCachedArea* area, int count, 140 CachedAreaHolder(DOMStorageCachedArea* area, int count,
136 int64 namespace_id) 141 int64 namespace_id)
137 : area_(area), open_count_(count), namespace_id_(namespace_id) {} 142 : area_(area), open_count_(count), namespace_id_(namespace_id) {}
138 }; 143 };
139 typedef std::map<std::string, CachedAreaHolder> CachedAreaMap; 144 typedef std::map<std::string, CachedAreaHolder> CachedAreaMap;
140 typedef std::list<CompletionCallback> CallbackList; 145 typedef std::list<CompletionCallback> CallbackList;
141 146
142 virtual ~ProxyImpl() { 147 ~ProxyImpl() override {}
143 }
144 148
145 // Sudden termination is disabled when there are callbacks pending 149 // Sudden termination is disabled when there are callbacks pending
146 // to more reliably commit changes during shutdown. 150 // to more reliably commit changes during shutdown.
147 void PushPendingCallback(const CompletionCallback& callback) { 151 void PushPendingCallback(const CompletionCallback& callback) {
148 if (pending_callbacks_.empty()) 152 if (pending_callbacks_.empty())
149 blink::Platform::current()->suddenTerminationChanged(false); 153 blink::Platform::current()->suddenTerminationChanged(false);
150 pending_callbacks_.push_back(callback); 154 pending_callbacks_.push_back(callback);
151 } 155 }
152 156
153 CompletionCallback PopPendingCallback() { 157 CompletionCallback PopPendingCallback() {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 359
356 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { 360 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) {
357 proxy_->CompleteOnePendingCallback(success); 361 proxy_->CompleteOnePendingCallback(success);
358 } 362 }
359 363
360 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) { 364 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) {
361 proxy_->ResetAllCachedAreas(namespace_id); 365 proxy_->ResetAllCachedAreas(namespace_id);
362 } 366 }
363 367
364 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/dom_storage/dom_storage_cached_area_unittest.cc ('k') | content/renderer/external_popup_menu_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698