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

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

Issue 8294015: base::Bind: Convert FileUtilProxy::ReadCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fixes. Created 9 years, 2 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 | « base/file_util_proxy.cc ('k') | no next file » | 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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 PP_CompletionCallback callback) { 169 PP_CompletionCallback callback) {
170 int32_t rv = CommonCallValidation(true, OPERATION_READ, callback); 170 int32_t rv = CommonCallValidation(true, OPERATION_READ, callback);
171 if (rv != PP_OK) 171 if (rv != PP_OK)
172 return rv; 172 return rv;
173 173
174 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); 174 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
175 if (!plugin_delegate) 175 if (!plugin_delegate)
176 return PP_ERROR_FAILED; 176 return PP_ERROR_FAILED;
177 177
178 if (!base::FileUtilProxy::Read( 178 if (!base::FileUtilProxy::Read(
179 plugin_delegate->GetFileThreadMessageLoopProxy(), 179 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, offset,
180 file_, offset, bytes_to_read, 180 bytes_to_read,
181 callback_factory_.NewCallback(&PPB_FileIO_Impl::ReadCallback))) 181 base::Bind(&PPB_FileIO_Impl::ReadCallback,
182 weak_factory_.GetWeakPtr())))
182 return PP_ERROR_FAILED; 183 return PP_ERROR_FAILED;
183 184
184 RegisterCallback(OPERATION_READ, callback, buffer); 185 RegisterCallback(OPERATION_READ, callback, buffer);
185 return PP_OK_COMPLETIONPENDING; 186 return PP_OK_COMPLETIONPENDING;
186 } 187 }
187 188
188 int32_t PPB_FileIO_Impl::Write(int64_t offset, 189 int32_t PPB_FileIO_Impl::Write(int64_t offset,
189 const char* buffer, 190 const char* buffer,
190 int32_t bytes_to_write, 191 int32_t bytes_to_write,
191 PP_CompletionCallback callback) { 192 PP_CompletionCallback callback) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 if (error_code != base::PLATFORM_FILE_OK) { 474 if (error_code != base::PLATFORM_FILE_OK) {
474 RunAndRemoveFirstPendingCallback( 475 RunAndRemoveFirstPendingCallback(
475 PlatformFileErrorToPepperError(error_code)); 476 PlatformFileErrorToPepperError(error_code));
476 } else { 477 } else {
477 RunAndRemoveFirstPendingCallback(bytes_written); 478 RunAndRemoveFirstPendingCallback(bytes_written);
478 } 479 }
479 } 480 }
480 481
481 } // namespace ppapi 482 } // namespace ppapi
482 } // namespace webkit 483 } // namespace webkit
OLDNEW
« no previous file with comments | « base/file_util_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698