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

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: 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 this, 108 this,
109 callback)); 109 callback));
110 } 110 }
111 111
112 void QuotaReservation::OnClientCrash() { 112 void QuotaReservation::OnClientCrash() {
113 quota_reservation_->OnClientCrash(); 113 quota_reservation_->OnClientCrash();
114 } 114 }
115 115
116 void QuotaReservation::GotReservedQuota( 116 void QuotaReservation::GotReservedQuota(
117 const ReserveQuotaCallback& callback, 117 const ReserveQuotaCallback& callback,
118 base::PlatformFileError error) { 118 base::File::Error error) {
119 OffsetMap max_written_offsets; 119 OffsetMap max_written_offsets;
120 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) { 120 for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) {
121 max_written_offsets.insert( 121 max_written_offsets.insert(
122 std::make_pair(it->first, it->second->GetEstimatedFileSize())); 122 std::make_pair(it->first, it->second->GetEstimatedFileSize()));
123 } 123 }
124 124
125 if (file_system_context_) { 125 if (file_system_context_) {
126 BrowserThread::PostTask( 126 BrowserThread::PostTask(
127 BrowserThread::IO, 127 BrowserThread::IO,
128 FROM_HERE, 128 FROM_HERE,
(...skipping 13 matching lines...) Expand all
142 file_system_context_->default_file_task_runner()->DeleteSoon( 142 file_system_context_->default_file_task_runner()->DeleteSoon(
143 FROM_HERE, 143 FROM_HERE,
144 this); 144 this);
145 } else { 145 } else {
146 // We're on the right thread to delete, or unit test. 146 // We're on the right thread to delete, or unit test.
147 delete this; 147 delete this;
148 } 148 }
149 } 149 }
150 150
151 } // namespace content 151 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698