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

Side by Side Diff: webkit/plugins/ppapi/ppb_file_io_impl.cc

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nulls auditeed Created 9 years, 4 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_io_impl.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_file_io_impl.h" 5 #include "webkit/plugins/ppapi/ppb_file_io_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "ppapi/c/ppb_file_io.h" 14 #include "ppapi/c/ppb_file_io.h"
15 #include "ppapi/c/trusted/ppb_file_io_trusted.h" 15 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
16 #include "ppapi/c/pp_completion_callback.h" 16 #include "ppapi/c/pp_completion_callback.h"
17 #include "ppapi/c/pp_errors.h" 17 #include "ppapi/c/pp_errors.h"
18 #include "ppapi/shared_impl/time_conversion.h" 18 #include "ppapi/shared_impl/time_conversion.h"
19 #include "ppapi/thunk/enter.h" 19 #include "ppapi/thunk/enter.h"
20 #include "ppapi/thunk/ppb_file_ref_api.h" 20 #include "ppapi/thunk/ppb_file_ref_api.h"
21 #include "webkit/plugins/ppapi/common.h" 21 #include "webkit/plugins/ppapi/common.h"
22 #include "webkit/plugins/ppapi/file_type_conversions.h" 22 #include "webkit/plugins/ppapi/file_type_conversions.h"
23 #include "webkit/plugins/ppapi/plugin_module.h" 23 #include "webkit/plugins/ppapi/plugin_module.h"
24 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 24 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
25 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" 25 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
26 #include "webkit/plugins/ppapi/quota_file_io.h" 26 #include "webkit/plugins/ppapi/quota_file_io.h"
27 #include "webkit/plugins/ppapi/resource_helper.h"
27 #include "webkit/plugins/ppapi/resource_tracker.h" 28 #include "webkit/plugins/ppapi/resource_tracker.h"
28 29
29 using ppapi::PPTimeToTime; 30 using ppapi::PPTimeToTime;
30 using ppapi::TimeToPPTime; 31 using ppapi::TimeToPPTime;
31 using ppapi::thunk::EnterResourceNoLock; 32 using ppapi::thunk::EnterResourceNoLock;
32 using ppapi::thunk::PPB_FileIO_API; 33 using ppapi::thunk::PPB_FileIO_API;
33 using ppapi::thunk::PPB_FileRef_API; 34 using ppapi::thunk::PPB_FileRef_API;
34 35
35 namespace webkit { 36 namespace webkit {
36 namespace ppapi { 37 namespace ppapi {
37 38
38 PPB_FileIO_Impl::CallbackEntry::CallbackEntry() 39 PPB_FileIO_Impl::CallbackEntry::CallbackEntry()
39 : read_buffer(NULL) { 40 : read_buffer(NULL) {
40 } 41 }
41 42
42 PPB_FileIO_Impl::CallbackEntry::CallbackEntry(const CallbackEntry& entry) 43 PPB_FileIO_Impl::CallbackEntry::CallbackEntry(const CallbackEntry& entry)
43 : callback(entry.callback), 44 : callback(entry.callback),
44 read_buffer(entry.read_buffer) { 45 read_buffer(entry.read_buffer) {
45 } 46 }
46 47
47 PPB_FileIO_Impl::CallbackEntry::~CallbackEntry() { 48 PPB_FileIO_Impl::CallbackEntry::~CallbackEntry() {
48 } 49 }
49 50
50 PPB_FileIO_Impl::PPB_FileIO_Impl(PluginInstance* instance) 51 PPB_FileIO_Impl::PPB_FileIO_Impl(PP_Instance instance)
51 : Resource(instance), 52 : Resource(instance),
52 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), 53 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
53 file_(base::kInvalidPlatformFileValue), 54 file_(base::kInvalidPlatformFileValue),
54 file_system_type_(PP_FILESYSTEMTYPE_INVALID), 55 file_system_type_(PP_FILESYSTEMTYPE_INVALID),
55 pending_op_(OPERATION_NONE), 56 pending_op_(OPERATION_NONE),
56 info_(NULL) { 57 info_(NULL) {
57 } 58 }
58 59
59 PPB_FileIO_Impl::~PPB_FileIO_Impl() { 60 PPB_FileIO_Impl::~PPB_FileIO_Impl() {
60 Close(); 61 Close();
(...skipping 12 matching lines...) Expand all
73 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object()); 74 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object());
74 75
75 int32_t rv = CommonCallValidation(false, OPERATION_EXCLUSIVE, callback); 76 int32_t rv = CommonCallValidation(false, OPERATION_EXCLUSIVE, callback);
76 if (rv != PP_OK) 77 if (rv != PP_OK)
77 return rv; 78 return rv;
78 79
79 int flags = 0; 80 int flags = 0;
80 if (!PepperFileOpenFlagsToPlatformFileFlags(open_flags, &flags)) 81 if (!PepperFileOpenFlagsToPlatformFileFlags(open_flags, &flags))
81 return PP_ERROR_BADARGUMENT; 82 return PP_ERROR_BADARGUMENT;
82 83
84 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
85 if (!plugin_delegate)
86 return false;
87
83 file_system_type_ = file_ref->GetFileSystemType(); 88 file_system_type_ = file_ref->GetFileSystemType();
84 switch (file_system_type_) { 89 switch (file_system_type_) {
85 case PP_FILESYSTEMTYPE_EXTERNAL: 90 case PP_FILESYSTEMTYPE_EXTERNAL:
86 if (!instance()->delegate()->AsyncOpenFile( 91 if (!plugin_delegate->AsyncOpenFile(
87 file_ref->GetSystemPath(), flags, 92 file_ref->GetSystemPath(), flags,
88 callback_factory_.NewCallback( 93 callback_factory_.NewCallback(
89 &PPB_FileIO_Impl::AsyncOpenFileCallback))) 94 &PPB_FileIO_Impl::AsyncOpenFileCallback)))
90 return PP_ERROR_FAILED; 95 return PP_ERROR_FAILED;
91 break; 96 break;
92 case PP_FILESYSTEMTYPE_LOCALPERSISTENT: 97 case PP_FILESYSTEMTYPE_LOCALPERSISTENT:
93 case PP_FILESYSTEMTYPE_LOCALTEMPORARY: 98 case PP_FILESYSTEMTYPE_LOCALTEMPORARY:
94 file_system_url_ = file_ref->GetFileSystemURL(); 99 file_system_url_ = file_ref->GetFileSystemURL();
95 if (!instance()->delegate()->AsyncOpenFileSystemURL( 100 if (!plugin_delegate->AsyncOpenFileSystemURL(
96 file_system_url_, flags, 101 file_system_url_, flags,
97 callback_factory_.NewCallback( 102 callback_factory_.NewCallback(
98 &PPB_FileIO_Impl::AsyncOpenFileCallback))) 103 &PPB_FileIO_Impl::AsyncOpenFileCallback)))
99 return PP_ERROR_FAILED; 104 return PP_ERROR_FAILED;
100 break; 105 break;
101 default: 106 default:
102 return PP_ERROR_FAILED; 107 return PP_ERROR_FAILED;
103 } 108 }
104 109
105 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); 110 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL);
106 return PP_OK_COMPLETIONPENDING; 111 return PP_OK_COMPLETIONPENDING;
107 } 112 }
108 113
109 int32_t PPB_FileIO_Impl::Query(PP_FileInfo* info, 114 int32_t PPB_FileIO_Impl::Query(PP_FileInfo* info,
110 PP_CompletionCallback callback) { 115 PP_CompletionCallback callback) {
111 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); 116 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback);
112 if (rv != PP_OK) 117 if (rv != PP_OK)
113 return rv; 118 return rv;
114 119
115 if (!info) 120 if (!info)
116 return PP_ERROR_BADARGUMENT; 121 return PP_ERROR_BADARGUMENT;
117 122
118 DCHECK(!info_); // If |info_|, a callback should be pending (caught above). 123 DCHECK(!info_); // If |info_|, a callback should be pending (caught above).
119 info_ = info; 124 info_ = info;
120 125
126 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
127 if (!plugin_delegate)
128 return PP_ERROR_FAILED;
129
121 if (!base::FileUtilProxy::GetFileInfoFromPlatformFile( 130 if (!base::FileUtilProxy::GetFileInfoFromPlatformFile(
122 instance()->delegate()->GetFileThreadMessageLoopProxy(), file_, 131 plugin_delegate->GetFileThreadMessageLoopProxy(), file_,
123 callback_factory_.NewCallback(&PPB_FileIO_Impl::QueryInfoCallback))) 132 callback_factory_.NewCallback(&PPB_FileIO_Impl::QueryInfoCallback)))
124 return PP_ERROR_FAILED; 133 return PP_ERROR_FAILED;
125 134
126 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); 135 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL);
127 return PP_OK_COMPLETIONPENDING; 136 return PP_OK_COMPLETIONPENDING;
128 } 137 }
129 138
130 int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time, 139 int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time,
131 PP_Time last_modified_time, 140 PP_Time last_modified_time,
132 PP_CompletionCallback callback) { 141 PP_CompletionCallback callback) {
133 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); 142 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback);
134 if (rv != PP_OK) 143 if (rv != PP_OK)
135 return rv; 144 return rv;
136 145
146 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
147 if (!plugin_delegate)
148 return PP_ERROR_FAILED;
149
137 if (!base::FileUtilProxy::Touch( 150 if (!base::FileUtilProxy::Touch(
138 instance()->delegate()->GetFileThreadMessageLoopProxy(), 151 plugin_delegate->GetFileThreadMessageLoopProxy(),
139 file_, PPTimeToTime(last_access_time), 152 file_, PPTimeToTime(last_access_time),
140 PPTimeToTime(last_modified_time), 153 PPTimeToTime(last_modified_time),
141 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback))) 154 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
142 return PP_ERROR_FAILED; 155 return PP_ERROR_FAILED;
143 156
144 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); 157 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL);
145 return PP_OK_COMPLETIONPENDING; 158 return PP_OK_COMPLETIONPENDING;
146 } 159 }
147 160
148 int32_t PPB_FileIO_Impl::Read(int64_t offset, 161 int32_t PPB_FileIO_Impl::Read(int64_t offset,
149 char* buffer, 162 char* buffer,
150 int32_t bytes_to_read, 163 int32_t bytes_to_read,
151 PP_CompletionCallback callback) { 164 PP_CompletionCallback callback) {
152 int32_t rv = CommonCallValidation(true, OPERATION_READ, callback); 165 int32_t rv = CommonCallValidation(true, OPERATION_READ, callback);
153 if (rv != PP_OK) 166 if (rv != PP_OK)
154 return rv; 167 return rv;
155 168
169 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
170 if (!plugin_delegate)
171 return PP_ERROR_FAILED;
172
156 if (!base::FileUtilProxy::Read( 173 if (!base::FileUtilProxy::Read(
157 instance()->delegate()->GetFileThreadMessageLoopProxy(), 174 plugin_delegate->GetFileThreadMessageLoopProxy(),
158 file_, offset, bytes_to_read, 175 file_, offset, bytes_to_read,
159 callback_factory_.NewCallback(&PPB_FileIO_Impl::ReadCallback))) 176 callback_factory_.NewCallback(&PPB_FileIO_Impl::ReadCallback)))
160 return PP_ERROR_FAILED; 177 return PP_ERROR_FAILED;
161 178
162 RegisterCallback(OPERATION_READ, callback, buffer); 179 RegisterCallback(OPERATION_READ, callback, buffer);
163 return PP_OK_COMPLETIONPENDING; 180 return PP_OK_COMPLETIONPENDING;
164 } 181 }
165 182
166 int32_t PPB_FileIO_Impl::Write(int64_t offset, 183 int32_t PPB_FileIO_Impl::Write(int64_t offset,
167 const char* buffer, 184 const char* buffer,
168 int32_t bytes_to_write, 185 int32_t bytes_to_write,
169 PP_CompletionCallback callback) { 186 PP_CompletionCallback callback) {
170 int32_t rv = CommonCallValidation(true, OPERATION_WRITE, callback); 187 int32_t rv = CommonCallValidation(true, OPERATION_WRITE, callback);
171 if (rv != PP_OK) 188 if (rv != PP_OK)
172 return rv; 189 return rv;
173 190
191 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
192 if (!plugin_delegate)
193 return PP_ERROR_FAILED;
194
174 if (quota_file_io_.get()) { 195 if (quota_file_io_.get()) {
175 if (!quota_file_io_->Write( 196 if (!quota_file_io_->Write(
176 offset, buffer, bytes_to_write, 197 offset, buffer, bytes_to_write,
177 callback_factory_.NewCallback(&PPB_FileIO_Impl::WriteCallback))) 198 callback_factory_.NewCallback(&PPB_FileIO_Impl::WriteCallback)))
178 return PP_ERROR_FAILED; 199 return PP_ERROR_FAILED;
179 } else { 200 } else {
180 if (!base::FileUtilProxy::Write( 201 if (!base::FileUtilProxy::Write(
181 instance()->delegate()->GetFileThreadMessageLoopProxy(), 202 plugin_delegate->GetFileThreadMessageLoopProxy(),
182 file_, offset, buffer, bytes_to_write, 203 file_, offset, buffer, bytes_to_write,
183 callback_factory_.NewCallback(&PPB_FileIO_Impl::WriteCallback))) 204 callback_factory_.NewCallback(&PPB_FileIO_Impl::WriteCallback)))
184 return PP_ERROR_FAILED; 205 return PP_ERROR_FAILED;
185 } 206 }
186 207
187 RegisterCallback(OPERATION_WRITE, callback, NULL); 208 RegisterCallback(OPERATION_WRITE, callback, NULL);
188 return PP_OK_COMPLETIONPENDING; 209 return PP_OK_COMPLETIONPENDING;
189 } 210 }
190 211
191 int32_t PPB_FileIO_Impl::SetLength(int64_t length, 212 int32_t PPB_FileIO_Impl::SetLength(int64_t length,
192 PP_CompletionCallback callback) { 213 PP_CompletionCallback callback) {
193 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); 214 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback);
194 if (rv != PP_OK) 215 if (rv != PP_OK)
195 return rv; 216 return rv;
196 217
218 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
219 if (!plugin_delegate)
220 return PP_ERROR_FAILED;
221
197 if (quota_file_io_.get()) { 222 if (quota_file_io_.get()) {
198 if (!quota_file_io_->SetLength( 223 if (!quota_file_io_->SetLength(
199 length, 224 length,
200 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback))) 225 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
201 return PP_ERROR_FAILED; 226 return PP_ERROR_FAILED;
202 } else { 227 } else {
203 if (!base::FileUtilProxy::Truncate( 228 if (!base::FileUtilProxy::Truncate(
204 instance()->delegate()->GetFileThreadMessageLoopProxy(), 229 plugin_delegate->GetFileThreadMessageLoopProxy(),
205 file_, length, 230 file_, length,
206 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback))) 231 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
207 return PP_ERROR_FAILED; 232 return PP_ERROR_FAILED;
208 } 233 }
209 234
210 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); 235 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL);
211 return PP_OK_COMPLETIONPENDING; 236 return PP_OK_COMPLETIONPENDING;
212 } 237 }
213 238
214 int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) { 239 int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) {
215 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback); 240 int32_t rv = CommonCallValidation(true, OPERATION_EXCLUSIVE, callback);
216 if (rv != PP_OK) 241 if (rv != PP_OK)
217 return rv; 242 return rv;
218 243
244 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
245 if (!plugin_delegate)
246 return PP_ERROR_FAILED;
247
219 if (!base::FileUtilProxy::Flush( 248 if (!base::FileUtilProxy::Flush(
220 instance()->delegate()->GetFileThreadMessageLoopProxy(), file_, 249 plugin_delegate->GetFileThreadMessageLoopProxy(), file_,
221 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback))) 250 callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
222 return PP_ERROR_FAILED; 251 return PP_ERROR_FAILED;
223 252
224 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL); 253 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL);
225 return PP_OK_COMPLETIONPENDING; 254 return PP_OK_COMPLETIONPENDING;
226 } 255 }
227 256
228 void PPB_FileIO_Impl::Close() { 257 void PPB_FileIO_Impl::Close() {
229 if (file_ != base::kInvalidPlatformFileValue) { 258 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
259 if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) {
230 base::FileUtilProxy::Close( 260 base::FileUtilProxy::Close(
231 instance()->delegate()->GetFileThreadMessageLoopProxy(), file_, NULL); 261 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, NULL);
232 file_ = base::kInvalidPlatformFileValue; 262 file_ = base::kInvalidPlatformFileValue;
233 quota_file_io_.reset(); 263 quota_file_io_.reset();
234 } 264 }
235 } 265 }
236 266
237 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() { 267 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() {
238 #if defined(OS_POSIX) 268 #if defined(OS_POSIX)
239 return file_; 269 return file_;
240 #elif defined(OS_WIN) 270 #elif defined(OS_WIN)
241 return reinterpret_cast<uintptr_t>(file_); 271 return reinterpret_cast<uintptr_t>(file_);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return PP_OK; 336 return PP_OK;
307 } 337 }
308 338
309 void PPB_FileIO_Impl::RegisterCallback(OperationType op, 339 void PPB_FileIO_Impl::RegisterCallback(OperationType op,
310 PP_CompletionCallback callback, 340 PP_CompletionCallback callback,
311 char* read_buffer) { 341 char* read_buffer) {
312 DCHECK(callback.func); 342 DCHECK(callback.func);
313 DCHECK(pending_op_ == OPERATION_NONE || 343 DCHECK(pending_op_ == OPERATION_NONE ||
314 (pending_op_ != OPERATION_EXCLUSIVE && pending_op_ == op)); 344 (pending_op_ != OPERATION_EXCLUSIVE && pending_op_ == op));
315 345
346 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
347 if (!plugin_module)
348 return;
349
316 CallbackEntry entry; 350 CallbackEntry entry;
317 entry.callback = new TrackedCompletionCallback( 351 entry.callback = new TrackedCompletionCallback(
318 instance()->module()->GetCallbackTracker(), pp_resource(), callback); 352 plugin_module->GetCallbackTracker(), pp_resource(), callback);
319 entry.read_buffer = read_buffer; 353 entry.read_buffer = read_buffer;
320 354
321 callbacks_.push(entry); 355 callbacks_.push(entry);
322 pending_op_ = op; 356 pending_op_ = op;
323 } 357 }
324 358
325 void PPB_FileIO_Impl::RunAndRemoveFirstPendingCallback(int32_t result) { 359 void PPB_FileIO_Impl::RunAndRemoveFirstPendingCallback(int32_t result) {
326 DCHECK(!callbacks_.empty()); 360 DCHECK(!callbacks_.empty());
327 361
328 CallbackEntry front = callbacks_.front(); 362 CallbackEntry front = callbacks_.front();
(...skipping 22 matching lines...) Expand all
351 } 385 }
352 386
353 DCHECK(file_ == base::kInvalidPlatformFileValue); 387 DCHECK(file_ == base::kInvalidPlatformFileValue);
354 file_ = file.ReleaseValue(); 388 file_ = file.ReleaseValue();
355 389
356 DCHECK(!quota_file_io_.get()); 390 DCHECK(!quota_file_io_.get());
357 if (file_ != base::kInvalidPlatformFileValue && 391 if (file_ != base::kInvalidPlatformFileValue &&
358 (file_system_type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY || 392 (file_system_type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY ||
359 file_system_type_ == PP_FILESYSTEMTYPE_LOCALPERSISTENT)) { 393 file_system_type_ == PP_FILESYSTEMTYPE_LOCALPERSISTENT)) {
360 quota_file_io_.reset(new QuotaFileIO( 394 quota_file_io_.reset(new QuotaFileIO(
361 instance(), file_, file_system_url_, file_system_type_)); 395 pp_instance(), file_, file_system_url_, file_system_type_));
362 } 396 }
363 397
364 RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code)); 398 RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code));
365 } 399 }
366 400
367 void PPB_FileIO_Impl::QueryInfoCallback( 401 void PPB_FileIO_Impl::QueryInfoCallback(
368 base::PlatformFileError error_code, 402 base::PlatformFileError error_code,
369 const base::PlatformFileInfo& file_info) { 403 const base::PlatformFileInfo& file_info) {
370 if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) { 404 if (pending_op_ != OPERATION_EXCLUSIVE || callbacks_.empty()) {
371 NOTREACHED(); 405 NOTREACHED();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 if (error_code != base::PLATFORM_FILE_OK) { 470 if (error_code != base::PLATFORM_FILE_OK) {
437 RunAndRemoveFirstPendingCallback( 471 RunAndRemoveFirstPendingCallback(
438 PlatformFileErrorToPepperError(error_code)); 472 PlatformFileErrorToPepperError(error_code));
439 } else { 473 } else {
440 RunAndRemoveFirstPendingCallback(bytes_written); 474 RunAndRemoveFirstPendingCallback(bytes_written);
441 } 475 }
442 } 476 }
443 477
444 } // namespace ppapi 478 } // namespace ppapi
445 } // namespace webkit 479 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_io_impl.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698