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

Side by Side Diff: content/browser/quota_dispatcher_host.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quota_dispatcher_host.h" 5 #include "content/browser/quota_dispatcher_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/memory/ptr_util.h"
10 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
11 #include "base/numerics/safe_conversions.h" 14 #include "base/numerics/safe_conversions.h"
12 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
13 #include "content/common/quota_messages.h" 16 #include "content/common/quota_messages.h"
14 #include "content/public/browser/quota_permission_context.h" 17 #include "content/public/browser/quota_permission_context.h"
15 #include "net/base/url_util.h" 18 #include "net/base/url_util.h"
16 #include "storage/browser/quota/quota_manager.h" 19 #include "storage/browser/quota/quota_manager.h"
17 #include "url/gurl.h" 20 #include "url/gurl.h"
18 21
19 using storage::QuotaClient; 22 using storage::QuotaClient;
20 using storage::QuotaManager; 23 using storage::QuotaManager;
21 using storage::QuotaStatusCode; 24 using storage::QuotaStatusCode;
22 using storage::StorageType; 25 using storage::StorageType;
23 26
24 namespace content { 27 namespace content {
25 28
26 // Created one per request to carry the request's request_id around. 29 // Created one per request to carry the request's request_id around.
27 // Dispatches requests from renderer/worker to the QuotaManager and 30 // Dispatches requests from renderer/worker to the QuotaManager and
28 // sends back the response to the renderer/worker. 31 // sends back the response to the renderer/worker.
29 class QuotaDispatcherHost::RequestDispatcher { 32 class QuotaDispatcherHost::RequestDispatcher {
30 public: 33 public:
31 RequestDispatcher(base::WeakPtr<QuotaDispatcherHost> dispatcher_host, 34 RequestDispatcher(base::WeakPtr<QuotaDispatcherHost> dispatcher_host,
32 int request_id) 35 int request_id)
33 : dispatcher_host_(dispatcher_host), 36 : dispatcher_host_(dispatcher_host),
34 render_process_id_(dispatcher_host->process_id_), 37 render_process_id_(dispatcher_host->process_id_),
35 request_id_(request_id) { 38 request_id_(request_id) {
36 dispatcher_host_->outstanding_requests_.AddWithID(this, request_id_); 39 dispatcher_host_->outstanding_requests_.AddWithID(base::WrapUnique(this),
40 request_id_);
37 } 41 }
38 virtual ~RequestDispatcher() {} 42 virtual ~RequestDispatcher() {}
39 43
40 protected: 44 protected:
41 // Subclass must call this when it's done with the request. 45 // Subclass must call this when it's done with the request.
42 void Completed() { 46 void Completed() {
43 if (dispatcher_host_) 47 if (dispatcher_host_)
44 dispatcher_host_->outstanding_requests_.Remove(request_id_); 48 dispatcher_host_->outstanding_requests_.Remove(request_id_);
45 } 49 }
46 50
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return; 270 return;
267 } 271 }
268 272
269 RequestQuotaDispatcher* dispatcher = 273 RequestQuotaDispatcher* dispatcher =
270 new RequestQuotaDispatcher(weak_factory_.GetWeakPtr(), 274 new RequestQuotaDispatcher(weak_factory_.GetWeakPtr(),
271 params); 275 params);
272 dispatcher->Start(); 276 dispatcher->Start();
273 } 277 }
274 278
275 } // namespace content 279 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/permissions/permission_service_impl.cc ('k') | content/child/fileapi/file_system_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698