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

Side by Side Diff: content/browser/renderer_host/pepper/quota_reservation.cc

Issue 501033003: Remove implicit conversions from scoped_refptr to T* in content/browser/renderer_host/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 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/renderer_host/pepper/quota_reservation.h" 5 #include "content/browser/renderer_host/pepper/quota_reservation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "webkit/browser/fileapi/file_system_operation_runner.h" 10 #include "webkit/browser/fileapi/file_system_operation_runner.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 QuotaReservation::~QuotaReservation() { 44 QuotaReservation::~QuotaReservation() {
45 // We should have no open files at this point. 45 // We should have no open files at this point.
46 DCHECK(files_.size() == 0); 46 DCHECK(files_.size() == 0);
47 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++it) 47 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++it)
48 delete it->second; 48 delete it->second;
49 } 49 }
50 50
51 int64_t QuotaReservation::OpenFile(int32_t id, 51 int64_t QuotaReservation::OpenFile(int32_t id,
52 const storage::FileSystemURL& url) { 52 const storage::FileSystemURL& url) {
53 base::FilePath platform_file_path; 53 base::FilePath platform_file_path;
54 if (file_system_context_) { 54 if (file_system_context_.get()) {
55 base::File::Error error = 55 base::File::Error error =
56 file_system_context_->operation_runner()->SyncGetPlatformPath( 56 file_system_context_->operation_runner()->SyncGetPlatformPath(
57 url, &platform_file_path); 57 url, &platform_file_path);
58 if (error != base::File::FILE_OK) { 58 if (error != base::File::FILE_OK) {
59 NOTREACHED(); 59 NOTREACHED();
60 return 0; 60 return 0;
61 } 61 }
62 } else { 62 } else {
63 // For test. 63 // For test.
64 platform_file_path = url.path(); 64 platform_file_path = url.path();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 void QuotaReservation::OnClientCrash() { quota_reservation_->OnClientCrash(); } 112 void QuotaReservation::OnClientCrash() { quota_reservation_->OnClientCrash(); }
113 113
114 void QuotaReservation::GotReservedQuota(const ReserveQuotaCallback& callback, 114 void QuotaReservation::GotReservedQuota(const ReserveQuotaCallback& callback,
115 base::File::Error error) { 115 base::File::Error error) {
116 ppapi::FileSizeMap file_sizes; 116 ppapi::FileSizeMap file_sizes;
117 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++it) 117 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++it)
118 file_sizes[it->first] = it->second->GetMaxWrittenOffset(); 118 file_sizes[it->first] = it->second->GetMaxWrittenOffset();
119 119
120 if (file_system_context_) { 120 if (file_system_context_.get()) {
121 BrowserThread::PostTask( 121 BrowserThread::PostTask(
122 BrowserThread::IO, 122 BrowserThread::IO,
123 FROM_HERE, 123 FROM_HERE,
124 base::Bind( 124 base::Bind(
125 callback, quota_reservation_->remaining_quota(), file_sizes)); 125 callback, quota_reservation_->remaining_quota(), file_sizes));
126 } else { 126 } else {
127 // Unit testing code path. 127 // Unit testing code path.
128 callback.Run(quota_reservation_->remaining_quota(), file_sizes); 128 callback.Run(quota_reservation_->remaining_quota(), file_sizes);
129 } 129 }
130 } 130 }
131 131
132 void QuotaReservation::DeleteOnCorrectThread() const { 132 void QuotaReservation::DeleteOnCorrectThread() const {
133 if (file_system_context_ && !file_system_context_->default_file_task_runner() 133 if (file_system_context_.get() &&
134 ->RunsTasksOnCurrentThread()) { 134 !file_system_context_->default_file_task_runner()
135 ->RunsTasksOnCurrentThread()) {
135 file_system_context_->default_file_task_runner()->DeleteSoon(FROM_HERE, 136 file_system_context_->default_file_task_runner()->DeleteSoon(FROM_HERE,
136 this); 137 this);
137 } else { 138 } else {
138 // We're on the right thread to delete, or unit test. 139 // We're on the right thread to delete, or unit test.
139 delete this; 140 delete this;
140 } 141 }
141 } 142 }
142 143
143 } // namespace content 144 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698