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" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 virtual void DidFail(PlatformFileError error) OVERRIDE { | 100 virtual void DidFail(PlatformFileError error) OVERRIDE { |
101 DidFinish(error, 0); | 101 DidFinish(error, 0); |
102 } | 102 } |
103 | 103 |
104 bool finished() const { return finished_; } | 104 bool finished() const { return finished_; } |
105 | 105 |
106 virtual void WillRunCallback() { | 106 virtual void WillRunCallback() { |
107 base::MessageLoopProxy::CreateForCurrentThread()->PostTask( | 107 base::MessageLoopProxy::current()->PostTask( |
108 FROM_HERE, runnable_factory_.NewRunnableMethod( | 108 FROM_HERE, runnable_factory_.NewRunnableMethod( |
109 &WriteOperation::RunCallback)); | 109 &WriteOperation::RunCallback)); |
110 } | 110 } |
111 | 111 |
112 private: | 112 private: |
113 void DidFinish(PlatformFileError status, int bytes_written) { | 113 void DidFinish(PlatformFileError status, int bytes_written) { |
114 finished_ = true; | 114 finished_ = true; |
115 status_ = status; | 115 status_ = status; |
116 bytes_written_ = bytes_written; | 116 bytes_written_ = bytes_written; |
117 int64_t max_offset = | 117 int64_t max_offset = |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 pending_callbacks_.pop_front(); | 353 pending_callbacks_.pop_front(); |
354 DCHECK(pending_callbacks_.empty()); | 354 DCHECK(pending_callbacks_.empty()); |
355 int64_t delta = (error != base::PLATFORM_FILE_OK) ? 0 : | 355 int64_t delta = (error != base::PLATFORM_FILE_OK) ? 0 : |
356 new_file_size - cached_file_size_; | 356 new_file_size - cached_file_size_; |
357 instance_->delegate()->DidUpdateFile(file_url_, delta); | 357 instance_->delegate()->DidUpdateFile(file_url_, delta); |
358 inflight_operations_ = 0; | 358 inflight_operations_ = 0; |
359 } | 359 } |
360 | 360 |
361 } // namespace ppapi | 361 } // namespace ppapi |
362 } // namespace webkit | 362 } // namespace webkit |
OLD | NEW |