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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
11 | 11 |
12 using base::PlatformFile; | 12 using base::PlatformFile; |
13 using base::PlatformFileError; | 13 using base::PlatformFileError; |
14 using quota::StorageType; | 14 using quota::StorageType; |
15 | 15 |
16 namespace webkit { | 16 namespace webkit { |
17 namespace ppapi { | 17 namespace ppapi { |
18 | 18 |
19 namespace { | 19 namespace { |
20 StorageType PPFileSystemTypeToQuotaStorageType(PP_FileSystemType type) { | 20 StorageType PPFileSystemTypeToQuotaStorageType(PP_FileSystemType type) { |
21 switch (type) { | 21 switch (type) { |
22 case PP_FILESYSTEMTYPE_LOCALPERSISTENT: | 22 case PP_FILESYSTEMTYPE_LOCALPERSISTENT: |
23 return quota::kStorageTypePersistent; | 23 return quota::kStorageTypePersistent; |
24 case PP_FILESYSTEMTYPE_LOCALTEMPORARY: | 24 case PP_FILESYSTEMTYPE_LOCALTEMPORARY: |
25 return quota::kStorageTypeTemporary; | 25 return quota::kStorageTypeTemporary; |
26 default: | 26 default: |
27 return quota::kStorageTypeUnknown; | 27 return quota::kStorageTypeUnknown; |
28 } | 28 } |
29 NOTREACHED(); | 29 NOTREACHED(); |
erikwright (departed)
2011/08/11 14:24:00
I wonder if removing the NOTREACHED would also wor
| |
30 return quota::kStorageTypeUnknown; | |
30 } | 31 } |
31 } // namespace | 32 } // namespace |
32 | 33 |
33 class QuotaFileIO::PendingOperationBase { | 34 class QuotaFileIO::PendingOperationBase { |
34 public: | 35 public: |
35 virtual ~PendingOperationBase() {} | 36 virtual ~PendingOperationBase() {} |
36 | 37 |
37 // Either one of Run() or DidFail() is called (the latter is called when | 38 // Either one of Run() or DidFail() is called (the latter is called when |
38 // there was more than one error during quota queries). | 39 // there was more than one error during quota queries). |
39 virtual void Run() = 0; | 40 virtual void Run() = 0; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 pending_callbacks_.pop_front(); | 353 pending_callbacks_.pop_front(); |
353 DCHECK(pending_callbacks_.empty()); | 354 DCHECK(pending_callbacks_.empty()); |
354 int64_t delta = (error != base::PLATFORM_FILE_OK) ? 0 : | 355 int64_t delta = (error != base::PLATFORM_FILE_OK) ? 0 : |
355 new_file_size - cached_file_size_; | 356 new_file_size - cached_file_size_; |
356 instance_->delegate()->DidUpdateFile(file_url_, delta); | 357 instance_->delegate()->DidUpdateFile(file_url_, delta); |
357 inflight_operations_ = 0; | 358 inflight_operations_ = 0; |
358 } | 359 } |
359 | 360 |
360 } // namespace ppapi | 361 } // namespace ppapi |
361 } // namespace webkit | 362 } // namespace webkit |
OLD | NEW |