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