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

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

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // We should have no open files at this point. 46 // We should have no open files at this point.
47 DCHECK(files_.size() == 0); 47 DCHECK(files_.size() == 0);
48 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) 48 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it)
49 delete it->second; 49 delete it->second;
50 } 50 }
51 51
52 int64_t QuotaReservation::OpenFile(int32_t id, 52 int64_t QuotaReservation::OpenFile(int32_t id,
53 const fileapi::FileSystemURL& url) { 53 const fileapi::FileSystemURL& url) {
54 base::FilePath platform_file_path; 54 base::FilePath platform_file_path;
55 if (file_system_context_) { 55 if (file_system_context_) {
56 base::PlatformFileError error = 56 base::File::Error error =
57 file_system_context_->operation_runner()->SyncGetPlatformPath( 57 file_system_context_->operation_runner()->SyncGetPlatformPath(
58 url, &platform_file_path); 58 url, &platform_file_path);
59 if (error != base::PLATFORM_FILE_OK) { 59 if (error != base::File::FILE_OK) {
60 NOTREACHED(); 60 NOTREACHED();
61 return 0; 61 return 0;
62 } 62 }
63 } else { 63 } else {
64 // For test. 64 // For test.
65 platform_file_path = url.path(); 65 platform_file_path = url.path();
66 } 66 }
67 67
68 scoped_ptr<fileapi::OpenFileHandle> file_handle = 68 scoped_ptr<fileapi::OpenFileHandle> file_handle =
69 quota_reservation_->GetOpenFileHandle(platform_file_path); 69 quota_reservation_->GetOpenFileHandle(platform_file_path);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 this, 113 this,
114 callback)); 114 callback));
115 } 115 }
116 116
117 void QuotaReservation::OnClientCrash() { 117 void QuotaReservation::OnClientCrash() {
118 quota_reservation_->OnClientCrash(); 118 quota_reservation_->OnClientCrash();
119 } 119 }
120 120
121 void QuotaReservation::GotReservedQuota( 121 void QuotaReservation::GotReservedQuota(
122 const ReserveQuotaCallback& callback, 122 const ReserveQuotaCallback& callback,
123 base::PlatformFileError error) { 123 base::File::Error error) {
124 ppapi::FileSizeMap max_written_offsets; 124 ppapi::FileSizeMap max_written_offsets;
125 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) { 125 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) {
126 max_written_offsets.insert( 126 max_written_offsets.insert(
127 std::make_pair(it->first, it->second->GetMaxWrittenOffset())); 127 std::make_pair(it->first, it->second->GetMaxWrittenOffset()));
128 } 128 }
129 129
130 if (file_system_context_) { 130 if (file_system_context_) {
131 BrowserThread::PostTask( 131 BrowserThread::PostTask(
132 BrowserThread::IO, 132 BrowserThread::IO,
133 FROM_HERE, 133 FROM_HERE,
(...skipping 13 matching lines...) Expand all
147 file_system_context_->default_file_task_runner()->DeleteSoon( 147 file_system_context_->default_file_task_runner()->DeleteSoon(
148 FROM_HERE, 148 FROM_HERE,
149 this); 149 this);
150 } else { 150 } else {
151 // We're on the right thread to delete, or unit test. 151 // We're on the right thread to delete, or unit test.
152 delete this; 152 delete this;
153 } 153 }
154 } 154 }
155 155
156 } // namespace content 156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698