OLD | NEW |
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/quota_file_io.h" | 5 #include "webkit/plugins/ppapi/quota_file_io.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_callback_factory.h" | 10 #include "base/memory/scoped_callback_factory.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "webkit/plugins/ppapi/host_globals.h" | |
16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
17 #include "webkit/plugins/ppapi/resource_helper.h" | 16 #include "webkit/plugins/ppapi/resource_helper.h" |
18 #include "webkit/plugins/ppapi/resource_tracker.h" | 17 #include "webkit/plugins/ppapi/resource_tracker.h" |
19 | 18 |
20 using base::PlatformFile; | 19 using base::PlatformFile; |
21 using base::PlatformFileError; | 20 using base::PlatformFileError; |
22 using quota::StorageType; | 21 using quota::StorageType; |
23 | 22 |
24 namespace webkit { | 23 namespace webkit { |
25 namespace ppapi { | 24 namespace ppapi { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 263 } |
265 | 264 |
266 bool QuotaFileIO::WillSetLength(int64_t length, | 265 bool QuotaFileIO::WillSetLength(int64_t length, |
267 const StatusCallback& callback) { | 266 const StatusCallback& callback) { |
268 DCHECK(pending_operations_.empty()); | 267 DCHECK(pending_operations_.empty()); |
269 SetLengthOperation* op = new SetLengthOperation(this, true, length, callback); | 268 SetLengthOperation* op = new SetLengthOperation(this, true, length, callback); |
270 return RegisterOperationForQuotaChecks(op); | 269 return RegisterOperationForQuotaChecks(op); |
271 } | 270 } |
272 | 271 |
273 PluginDelegate* QuotaFileIO::GetPluginDelegate() const { | 272 PluginDelegate* QuotaFileIO::GetPluginDelegate() const { |
274 PluginInstance* instance = | 273 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance_); |
275 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance_); | |
276 if (instance) | 274 if (instance) |
277 return instance->delegate(); | 275 return instance->delegate(); |
278 return NULL; | 276 return NULL; |
279 } | 277 } |
280 | 278 |
281 bool QuotaFileIO::RegisterOperationForQuotaChecks( | 279 bool QuotaFileIO::RegisterOperationForQuotaChecks( |
282 PendingOperationBase* op_ptr) { | 280 PendingOperationBase* op_ptr) { |
283 scoped_ptr<PendingOperationBase> op(op_ptr); | 281 scoped_ptr<PendingOperationBase> op(op_ptr); |
284 if (pending_operations_.empty()) { | 282 if (pending_operations_.empty()) { |
285 // This is the first pending quota check. Run querying the file size | 283 // This is the first pending quota check. Run querying the file size |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 396 |
399 | 397 |
400 PluginDelegate* plugin_delegate = GetPluginDelegate(); | 398 PluginDelegate* plugin_delegate = GetPluginDelegate(); |
401 if (plugin_delegate) | 399 if (plugin_delegate) |
402 plugin_delegate->DidUpdateFile(file_url_, delta); | 400 plugin_delegate->DidUpdateFile(file_url_, delta); |
403 inflight_operations_ = 0; | 401 inflight_operations_ = 0; |
404 } | 402 } |
405 | 403 |
406 } // namespace ppapi | 404 } // namespace ppapi |
407 } // namespace webkit | 405 } // namespace webkit |
OLD | NEW |