diff options
author | polina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 22:46:44 +0000 |
---|---|---|
committer | polina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 22:46:44 +0000 |
commit | 996bdbda28035f7f68955525625c998290706281 (patch) | |
tree | dfc61c5633359f02e40421e0240aeac25753b642 | |
parent | a965ca65e8170b3d685b7ca9185929fe3915b7f9 (diff) | |
download | chromium_src-996bdbda28035f7f68955525625c998290706281.zip chromium_src-996bdbda28035f7f68955525625c998290706281.tar.gz chromium_src-996bdbda28035f7f68955525625c998290706281.tar.bz2 |
1;2cReplace PP_ERROR_WOULDBLOCK with PP_OK_COMPLETIONPENDING. Improve error code comments. Update all code that uses this error code. Keep the old code for now flagging it as deprecated. Update copyrights.
BUG=none
TEST=bots
Review URL: http://codereview.chromium.org/6814033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81168 0039d316-1c4b-4281-b951-d872f2087c98
43 files changed, 234 insertions, 228 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index b4b5b3f..f8b5355 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -766,7 +766,7 @@ int32_t PepperPluginDelegateImpl::ConnectTcp( return PP_ERROR_FAILED; } - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PepperPluginDelegateImpl::ConnectTcpAddress( @@ -783,7 +783,7 @@ int32_t PepperPluginDelegateImpl::ConnectTcpAddress( return PP_ERROR_FAILED; } - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PepperPluginDelegateImpl::OnConnectTcpACK( @@ -839,7 +839,7 @@ int32_t PepperPluginDelegateImpl::ShowContextMenu( return PP_ERROR_FAILED; } - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PepperPluginDelegateImpl::OnContextMenuClosed( diff --git a/ppapi/api/pp_errors.idl b/ppapi/api/pp_errors.idl index 59db3455..3214bae 100644 --- a/ppapi/api/pp_errors.idl +++ b/ppapi/api/pp_errors.idl @@ -3,55 +3,62 @@ * found in the LICENSE file. */ -/* This file defines an enumeration of all PPAPI errors. */ +/* This file defines an enumeration of all PPAPI error codes. */ -/* This enumeration contains enumerators of all PPAPI errors. +/* This enumeration contains enumerators of all PPAPI error codes. * Errors are negative valued. */ enum PP_Error { - PP_OK = 0, - /* This value is returned by a function that accepts a PP_CompletionCallback - * and cannot complete synchronously. This error indicates that the given + /** + * This value is returned by a function on successful synchronous completion + * or is passed as a result to a PP_CompletionCallback_Func on successful + * asynchronous completion. + */ + PP_OK = 0, + /** + * This value is returned by a function that accepts a PP_CompletionCallback + * and cannot complete synchronously. This code indicates that the given * callback will be asynchronously notified of the final result once it is * available. */ - PP_ERROR_WOULDBLOCK = -1, + PP_OK_COMPLETIONPENDING = -1, + PP_ERROR_WOULDBLOCK = -1, /* DEPRECATED: DO NOT USE */ /* This value indicates failure for unspecified reasons. */ - PP_ERROR_FAILED = -2, + PP_ERROR_FAILED = -2, /* This value indicates failure due to an asynchronous operation being * interrupted, typically as a result of user action. */ - PP_ERROR_ABORTED = -3, + PP_ERROR_ABORTED = -3, /* This value indicates failure due to an invalid argument. */ - PP_ERROR_BADARGUMENT = -4, + PP_ERROR_BADARGUMENT = -4, /* This value indicates failure due to an invalid PP_Resource. */ - PP_ERROR_BADRESOURCE = -5, + PP_ERROR_BADRESOURCE = -5, /* This value indicates failure due to an unavailable PPAPI interface. */ - PP_ERROR_NOINTERFACE = -6, + PP_ERROR_NOINTERFACE = -6, /* This value indicates failure due to insufficient privileges. */ - PP_ERROR_NOACCESS = -7, + PP_ERROR_NOACCESS = -7, /* This value indicates failure due to insufficient memory. */ - PP_ERROR_NOMEMORY = -8, + PP_ERROR_NOMEMORY = -8, /* This value indicates failure due to insufficient storage space. */ - PP_ERROR_NOSPACE = -9, + PP_ERROR_NOSPACE = -9, /* This value indicates failure due to insufficient storage quota. */ - PP_ERROR_NOQUOTA = -10, + PP_ERROR_NOQUOTA = -10, /* This value indicates failure due to an action already being in progress. */ - PP_ERROR_INPROGRESS = -11, + PP_ERROR_INPROGRESS = -11, /* This value indicates failure due to a file that does not exist. */ - PP_ERROR_FILENOTFOUND = -20, + PP_ERROR_FILENOTFOUND = -20, /* This value indicates failure due to a file that already exists. */ - PP_ERROR_FILEEXISTS = -21, + PP_ERROR_FILEEXISTS = -21, /* This value indicates failure due to a file that is too big. */ - PP_ERROR_FILETOOBIG = -22, + PP_ERROR_FILETOOBIG = -22, /* This value indicates failure due to a file having been modified * unexpectedly. */ - PP_ERROR_FILECHANGED = -23, + PP_ERROR_FILECHANGED = -23, /* This value indicates failure due to a time limit being exceeded. */ - PP_ERROR_TIMEDOUT = -30, + PP_ERROR_TIMEDOUT = -30, /* This value indicates that the user cancelled rather than providing expected * input. */ - PP_ERROR_USERCANCEL = -40 + PP_ERROR_USERCANCEL = -40 }; diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h index 72ebb67..fad88f9 100644 --- a/ppapi/c/dev/ppb_transport_dev.h +++ b/ppapi/c/dev/ppb_transport_dev.h @@ -34,13 +34,13 @@ struct PPB_Transport_Dev { // RTT // Establishes a connection to the remote peer. Returns - // PP_ERROR_WOULDBLOCK and notifies on |cb| when connectivity is + // PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is // established (or timeout occurs). int32_t (*Connect)(PP_Resource transport, struct PP_CompletionCallback cb); // Obtains another ICE candidate address to be provided to the - // remote peer. Returns PP_ERROR_WOULDBLOCK if there are no more + // remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more // addresses to be sent. After the callback is called // GetNextAddress() must be called again to get the address. int32_t (*GetNextAddress)(PP_Resource transport, @@ -51,14 +51,14 @@ struct PPB_Transport_Dev { int32_t (*ReceiveRemoteAddress)(PP_Resource transport, struct PP_Var address); - // Like recv(), receives data. Returns PP_ERROR_WOULDBLOCK if there + // Like recv(), receives data. Returns PP_OK_COMPLETIONPENDING if there // is currently no data to receive. In that case, the |data| pointer // should remain valid until the callback is called. int32_t (*Recv)(PP_Resource transport, void* data, uint32_t len, struct PP_CompletionCallback cb); - // Like send(), sends data. Returns PP_ERROR_WOULDBLOCK if the + // Like send(), sends data. Returns PP_OK_COMPLETIONPENDING if the // socket is currently flow-controlled. In that case, the |data| // pointer should remain valid until the callback is called. int32_t (*Send)(PP_Resource transport, diff --git a/ppapi/c/pp_completion_callback.h b/ppapi/c/pp_completion_callback.h index 927b185..96edf6f 100644 --- a/ppapi/c/pp_completion_callback.h +++ b/ppapi/c/pp_completion_callback.h @@ -37,7 +37,7 @@ typedef void (*PP_CompletionCallback_Func)(void* user_data, int32_t result); /** * Any method that takes a PP_CompletionCallback has the option of completing * asynchronously if the operation would block. Such a method should return - * PP_ERROR_WOULDBLOCK to indicate that the method will complete + * PP_OK_COMPLETIONPENDING to indicate that the method will complete * asynchronously and will always be invoked from the main thread of PPAPI * execution. If the completion callback is NULL, then the operation will * block if necessary to complete its work. PP_BlockUntilComplete() provides a @@ -126,4 +126,3 @@ PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete() { */ #endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */ - diff --git a/ppapi/c/pp_errors.h b/ppapi/c/pp_errors.h index 36911b2..da2f5b4 100644 --- a/ppapi/c/pp_errors.h +++ b/ppapi/c/pp_errors.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 The Chromium Authors. All rights reserved. +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,7 +7,7 @@ /** * @file - * This file defines an enumeration of all Native Client errors. + * This file defines an enumeration of all PPAPI error codes. */ /** @@ -16,19 +16,25 @@ * @{ */ -/** This enumeration contains enumerators of all Native Client errors. +/** This enumeration contains enumerators of all PPAPI error codes. * Errors are negative valued. */ enum { + /** + * This value is returned by a function on successful synchronous completion + * or is passed as a result to a PP_CompletionCallback_Func on successful + * asynchronous completion. + */ PP_OK = 0, /** * This value is returned by a function that accepts a PP_CompletionCallback - * and cannot complete synchronously. This error indicates that the given + * and cannot complete synchronously. This code indicates that the given * callback will be asynchronously notified of the final result once it is * available. */ - PP_ERROR_WOULDBLOCK = -1, + PP_OK_COMPLETIONPENDING = -1, + PP_ERROR_WOULDBLOCK = -1, /* DEPRECATED: DO NOT USE */ /** This value indicates failure for unspecified reasons. */ PP_ERROR_FAILED = -2, @@ -96,4 +102,3 @@ enum { */ #endif /* PPAPI_C_PP_ERRORS_H_ */ - diff --git a/ppapi/cpp/completion_callback.h b/ppapi/cpp/completion_callback.h index 3cec39a..92403f3 100644 --- a/ppapi/cpp/completion_callback.h +++ b/ppapi/cpp/completion_callback.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,7 +69,7 @@ class CompletionCallback { // void ProcessFile(const FileRef& file) { // CompletionCallback cc = factory_.NewCallback(&MyHandler::DidOpen); // int32_t rv = fio_.Open(file, PP_FileOpenFlag_Read, cc); -// if (rv != PP_ERROR_WOULDBLOCK) +// if (rv != PP_OK_COMPLETIONPENDING) // cc.Run(rv); // } // @@ -103,7 +103,7 @@ class CompletionCallback { // CompletionCallback cc = factory_.NewCallback(&MyHandler::DidRead); // int32_t rv = fio_.Read(offset_, buf_, sizeof(buf_), // cc.pp_completion_callback()); -// if (rv != PP_ERROR_WOULDBLOCK) +// if (rv != PP_OK_COMPLETIONPENDING) // cc.Run(rv); // } // @@ -148,7 +148,7 @@ class CompletionCallbackFactory { // Allocates a new, single-use CompletionCallback. The CompletionCallback // must be run in order for the memory allocated by NewCallback to be freed. // If after passing the CompletionCallback to a PPAPI method, the method does - // not return PP_ERROR_WOULDBLOCK, then you should manually call the + // not return PP_OK_COMPLETIONPENDING, then you should manually call the // CompletionCallback's Run method otherwise memory will be leaked. template <typename Method> diff --git a/ppapi/cpp/paint_manager.cc b/ppapi/cpp/paint_manager.cc index a555c52..1508333 100644 --- a/ppapi/cpp/paint_manager.cc +++ b/ppapi/cpp/paint_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -146,7 +146,7 @@ void PaintManager::DoPaint() { // re-use devices in this way. PP_DCHECK(result != PP_ERROR_INPROGRESS); - if (result == PP_ERROR_WOULDBLOCK) { + if (result == PP_OK_COMPLETIONPENDING) { flush_pending_ = true; } else { PP_DCHECK(result == PP_OK); // Catch all other errors in debug mode. diff --git a/ppapi/example/example.cc b/ppapi/example/example.cc index 1eef073..d660bc4 100644 --- a/ppapi/example/example.cc +++ b/ppapi/example/example.cc @@ -107,7 +107,7 @@ class MyFetcher { pp::CompletionCallback callback = callback_factory_.NewCallback(&MyFetcher::DidOpen); int rv = loader_.Open(request, callback); - if (rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK_COMPLETIONPENDING) callback.Run(rv); } @@ -124,7 +124,7 @@ class MyFetcher { pp::CompletionCallback callback = callback_factory_.NewCallback(&MyFetcher::DidRead); int rv = loader_.ReadResponseBody(buf_, sizeof(buf_), callback); - if (rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK_COMPLETIONPENDING) callback.Run(rv); } diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index 65f4b34..6e34674 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -196,7 +196,7 @@ void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, int32_t open_error = audio_trusted->Open(result->host_resource(), config_id.host_resource(), callback.pp_completion_callback()); - if (open_error != PP_ERROR_WOULDBLOCK) + if (open_error != PP_OK_COMPLETIONPENDING) callback.Run(open_error); } diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc index c89c36a..a7a98c6 100644 --- a/ppapi/proxy/ppb_file_chooser_proxy.cc +++ b/ppapi/proxy/ppb_file_chooser_proxy.cc @@ -107,7 +107,7 @@ int32_t Show(PP_Resource chooser, struct PP_CompletionCallback callback) { dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Show( INTERFACE_ID_PPB_FILE_CHOOSER, object->host_resource())); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } PP_Resource GetNextChosenFile(PP_Resource chooser) { @@ -189,7 +189,7 @@ void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) { int32_t result = ppb_file_chooser_target()->Show( chooser.host_resource(), callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) callback.Run(result); } diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc index ddf29e4..3348818 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.cc +++ b/ppapi/proxy/ppb_file_ref_proxy.cc @@ -140,7 +140,7 @@ int32_t MakeDirectory(PP_Resource directory_ref, dispatcher->Send(new PpapiHostMsg_PPBFileRef_MakeDirectory( INTERFACE_ID_PPB_FILE_REF, object->host_resource(), make_ancestors, dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Touch(PP_Resource file_ref, @@ -156,7 +156,7 @@ int32_t Touch(PP_Resource file_ref, INTERFACE_ID_PPB_FILE_REF, object->host_resource(), last_access_time, last_modified_time, dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Delete(PP_Resource file_ref, @@ -169,7 +169,7 @@ int32_t Delete(PP_Resource file_ref, dispatcher->Send(new PpapiHostMsg_PPBFileRef_Delete( INTERFACE_ID_PPB_FILE_REF, object->host_resource(), dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Rename(PP_Resource file_ref, @@ -192,7 +192,7 @@ int32_t Rename(PP_Resource file_ref, INTERFACE_ID_PPB_FILE_REF, obj1->host_resource(), obj2->host_resource(), dispatcher1->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } const PPB_FileRef_Dev file_ref_interface = { @@ -307,7 +307,7 @@ void PPB_FileRef_Proxy::OnMsgMakeDirectory(const HostResource& host_resource, int32_t result = ppb_file_ref_target()->MakeDirectory(host_resource.host_resource(), make_ancestors, callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } @@ -319,7 +319,7 @@ void PPB_FileRef_Proxy::OnMsgTouch(const HostResource& host_resource, int32_t result = ppb_file_ref_target()->Touch(host_resource.host_resource(), last_access, last_modified, callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } @@ -328,7 +328,7 @@ void PPB_FileRef_Proxy::OnMsgDelete(const HostResource& host_resource, PP_CompletionCallback callback = ReceiveCallback(serialized_callback); int32_t result = ppb_file_ref_target()->Delete(host_resource.host_resource(), callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } @@ -340,7 +340,7 @@ void PPB_FileRef_Proxy::OnMsgRename(const HostResource& file_ref, ppb_file_ref_target()->Rename(file_ref.host_resource(), new_file_ref.host_resource(), callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc index 74c8bcc..54af096 100644 --- a/ppapi/proxy/ppb_file_system_proxy.cc +++ b/ppapi/proxy/ppb_file_system_proxy.cc @@ -104,7 +104,7 @@ int32_t Open(PP_Resource file_system, dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Open( INTERFACE_ID_PPB_FILE_SYSTEM, object->host_resource(), expected_size)); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } PP_FileSystemType_Dev GetType(PP_Resource resource) { @@ -177,7 +177,7 @@ void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource, int32_t result = ppb_file_system_target()->Open( host_resource.host_resource(), expected_size, callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) callback.Run(result); } diff --git a/ppapi/proxy/ppb_flash_menu_proxy.cc b/ppapi/proxy/ppb_flash_menu_proxy.cc index 1f37768..505ea5d 100644 --- a/ppapi/proxy/ppb_flash_menu_proxy.cc +++ b/ppapi/proxy/ppb_flash_menu_proxy.cc @@ -83,7 +83,7 @@ int32_t Show(PP_Resource menu_id, dispatcher->Send(new PpapiHostMsg_PPBFlashMenu_Show( INTERFACE_ID_PPB_FLASH_MENU, object->host_resource(), *location)); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } const PPB_Flash_Menu flash_menu_interface = { @@ -159,7 +159,7 @@ void PPB_Flash_Menu_Proxy::OnMsgShow(const HostResource& menu, &location, &request->selected_id, callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) { + if (result != PP_OK_COMPLETIONPENDING) { // There was some error, so we won't get a callback. We need to now issue // the ACK to the plugin so that it hears about the error. This will also // clean up the data associated with the callback. diff --git a/ppapi/proxy/ppb_flash_net_connector_proxy.cc b/ppapi/proxy/ppb_flash_net_connector_proxy.cc index 3a3d620..ee5a8d0 100644 --- a/ppapi/proxy/ppb_flash_net_connector_proxy.cc +++ b/ppapi/proxy/ppb_flash_net_connector_proxy.cc @@ -141,7 +141,7 @@ int32_t ConnectWithMessage(FlashNetConnector* object, dispatcher->Send(msg_deletor.release()); object->SetCallback(callback, socket_out, local_addr_out, remote_addr_out); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t ConnectTcp(PP_Resource connector_id, @@ -251,7 +251,7 @@ void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcp( resource.host_resource(), host.c_str(), port, &info->handle, &info->local_addr, &info->remote_addr, callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) OnCompleteCallbackInHost(result, info); } @@ -269,7 +269,7 @@ void PPB_Flash_NetConnector_Proxy::OnMsgConnectTcpAddress( resource.host_resource(), &net_address, &info->handle, &info->local_addr, &info->remote_addr, callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) OnCompleteCallbackInHost(result, info); } diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc index 4c488f9..3f1c8ef 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc @@ -186,7 +186,7 @@ int32_t Flush(PP_Resource graphics_2d, dispatcher->Send(new PpapiHostMsg_PPBGraphics2D_Flush( INTERFACE_ID_PPB_GRAPHICS_2D, object->host_resource())); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } const PPB_Graphics2D graphics_2d_interface = { @@ -288,7 +288,7 @@ void PPB_Graphics2D_Proxy::OnMsgFlush(const HostResource& graphics_2d) { &PPB_Graphics2D_Proxy::SendFlushACKToPlugin, graphics_2d); int32_t result = ppb_graphics_2d_target()->Flush( graphics_2d.host_resource(), callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) { + if (result != PP_OK_COMPLETIONPENDING) { // There was some error, so we won't get a flush callback. We need to now // issue the ACK to the plugin hears about the error. This will also clean // up the data associated with the callback. diff --git a/ppapi/proxy/ppb_surface_3d_proxy.cc b/ppapi/proxy/ppb_surface_3d_proxy.cc index 856d121..3a20aa1 100644 --- a/ppapi/proxy/ppb_surface_3d_proxy.cc +++ b/ppapi/proxy/ppb_surface_3d_proxy.cc @@ -100,7 +100,7 @@ int32_t SwapBuffers(PP_Resource surface_id, object->context()->gles2_impl()->SwapBuffers(); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } const PPB_Surface3D_Dev surface_3d_interface = { @@ -170,7 +170,7 @@ void PPB_Surface3D_Proxy::OnMsgSwapBuffers(const HostResource& surface_3d) { &PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin, surface_3d); int32_t result = ppb_surface_3d_target()->SwapBuffers( surface_3d.host_resource(), callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) { + if (result != PP_OK_COMPLETIONPENDING) { // There was some error, so we won't get a flush callback. We need to now // issue the ACK to the plugin hears about the error. This will also clean // up the data associated with the callback. diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index b338605..1489923 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -153,7 +153,7 @@ int32_t Open(PP_Resource loader_id, INTERFACE_ID_PPB_URL_LOADER, loader_object->host_resource(), request_object->host_resource(), dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t FollowRedirect(PP_Resource loader_id, @@ -166,7 +166,7 @@ int32_t FollowRedirect(PP_Resource loader_id, dispatcher->Send(new PpapiHostMsg_PPBURLLoader_FollowRedirect( INTERFACE_ID_PPB_URL_LOADER, loader_object->host_resource(), dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } PP_Bool GetUploadProgress(PP_Resource loader_id, @@ -229,7 +229,7 @@ int32_t ReadResponseBody(PP_Resource loader_id, dispatcher->Send(new PpapiHostMsg_PPBURLLoader_ReadResponseBody( INTERFACE_ID_PPB_URL_LOADER, loader_object->host_resource(), bytes_to_read)); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t FinishStreamingToFile(PP_Resource loader_id, @@ -242,7 +242,7 @@ int32_t FinishStreamingToFile(PP_Resource loader_id, dispatcher->Send(new PpapiHostMsg_PPBURLLoader_FinishStreamingToFile( INTERFACE_ID_PPB_URL_LOADER, loader_object->host_resource(), dispatcher->callback_tracker().SendCallback(callback))); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void Close(PP_Resource loader_id) { @@ -402,7 +402,7 @@ void PPB_URLLoader_Proxy::OnMsgOpen(const HostResource& loader, PP_CompletionCallback callback = ReceiveCallback(serialized_callback); int32_t result = ppb_url_loader_target()->Open( loader.host_resource(), request_info.host_resource(), callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); // TODO(brettw) bug 73236 register for the status callbacks. } @@ -413,7 +413,7 @@ void PPB_URLLoader_Proxy::OnMsgFollowRedirect( PP_CompletionCallback callback = ReceiveCallback(serialized_callback); int32_t result = ppb_url_loader_target()->FollowRedirect( loader.host_resource(), callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } @@ -449,7 +449,7 @@ void PPB_URLLoader_Proxy::OnMsgReadResponseBody( int32_t result = ppb_url_loader_target()->ReadResponseBody( loader.host_resource(), const_cast<char*>(info->read_buffer.c_str()), bytes_to_read, callback.pp_completion_callback()); - if (result != PP_ERROR_WOULDBLOCK) { + if (result != PP_OK_COMPLETIONPENDING) { // Send error (or perhaps success for synchronous reads) back to plugin. // The callback function is already set up to do this and also delete the // callback info. @@ -463,7 +463,7 @@ void PPB_URLLoader_Proxy::OnMsgFinishStreamingToFile( PP_CompletionCallback callback = ReceiveCallback(serialized_callback); int32_t result = ppb_url_loader_target()->FinishStreamingToFile( loader.host_resource(), callback); - if (result != PP_ERROR_WOULDBLOCK) + if (result != PP_OK_COMPLETIONPENDING) PP_RunCompletionCallback(&callback, result); } diff --git a/ppapi/tests/test_directory_reader.cc b/ppapi/tests/test_directory_reader.cc index 45e9a99..8fa3794 100644 --- a/ppapi/tests/test_directory_reader.cc +++ b/ppapi/tests/test_directory_reader.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,7 +44,7 @@ std::string TestDirectoryReader::TestGetNextFile() { pp::FileSystem_Dev file_system( instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -56,19 +56,19 @@ std::string TestDirectoryReader::TestGetNextFile() { pp::FileIO_Dev file_io_1; rv = file_io_1.Open(file_ref_1, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); pp::FileIO_Dev file_io_2; rv = file_io_2.Open(file_ref_2, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); pp::FileIO_Dev file_io_3; rv = file_io_3.Open(file_ref_3, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -77,17 +77,17 @@ std::string TestDirectoryReader::TestGetNextFile() { pp::FileRef_Dev dir_ref_2(file_system, "/dir_2"); pp::FileRef_Dev dir_ref_3(file_system, "/dir_3"); rv = dir_ref_1.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileRef::MakeDirectory", rv); rv = dir_ref_2.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileRef::MakeDirectory", rv); rv = dir_ref_3.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileRef::MakeDirectory", rv); @@ -98,7 +98,7 @@ std::string TestDirectoryReader::TestGetNextFile() { pp::DirectoryEntry_Dev entry; do { rv = directory_reader.GetNextEntry(&entry, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("DirectoryReader::GetNextEntry", rv); @@ -156,7 +156,7 @@ std::string TestDirectoryReader::TestGetNextFile() { // If |GetNextEntry()| is completing asynchronously, the callback should be // aborted (i.e., called with |PP_ERROR_ABORTED| from the message loop) // since the resource was destroyed. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // |GetNextEntry()| *may* have written to |entry| (e.g., synchronously, // before the resource was destroyed), but it must not write to it after // destruction. diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc index 4a7278f..53a441b 100644 --- a/ppapi/tests/test_file_io.cc +++ b/ppapi/tests/test_file_io.cc @@ -39,7 +39,7 @@ int32_t ReadEntireFile(PP_Instance instance, for (;;) { int32_t rv = file_io->Read(read_offset, buf, sizeof(buf), callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv < 0) return rv; @@ -64,7 +64,7 @@ int32_t WriteEntireBuffer(PP_Instance instance, while (write_offset < offset + size) { int32_t rv = file_io->Write(write_offset, &buf[write_offset - offset], size - write_offset + offset, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv < 0) return rv; @@ -98,14 +98,14 @@ std::string TestFileIO::TestOpen() { pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); pp::FileRef_Dev file_ref(file_system, "/file_open"); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -115,7 +115,7 @@ std::string TestFileIO::TestOpen() { pp::FileIO_Dev nonexistent_file_io(instance_); rv = nonexistent_file_io.Open( nonexistent_file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_ERROR_FILENOTFOUND) return ReportError("FileIO::Open", rv); @@ -129,7 +129,7 @@ std::string TestFileIO::TestReadWriteSetLength() { pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); pp::FileRef_Dev file_ref(file_system, "/file_read_write_setlength"); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -140,7 +140,7 @@ std::string TestFileIO::TestReadWriteSetLength() { PP_FILEOPENFLAG_READ | PP_FILEOPENFLAG_WRITE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -160,7 +160,7 @@ std::string TestFileIO::TestReadWriteSetLength() { // Truncate the file. rv = file_io.SetLength(4, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::SetLength", rv); @@ -197,7 +197,7 @@ std::string TestFileIO::TestReadWriteSetLength() { // Extend the file. rv = file_io.SetLength(16, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::SetLength", rv); @@ -242,7 +242,7 @@ std::string TestFileIO::TestTouchQuery() { pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -252,14 +252,14 @@ std::string TestFileIO::TestTouchQuery() { rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); // Write some data to have a non-zero file size. rv = file_io.Write(0, "test", 4, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != 4) return ReportError("FileIO::Write", rv); @@ -269,14 +269,14 @@ std::string TestFileIO::TestTouchQuery() { const PP_Time last_access_time = 123 * 24 * 3600.0; const PP_Time last_modified_time = 246.0; rv = file_io.Touch(last_access_time, last_modified_time, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Touch", rv); PP_FileInfo_Dev info; rv = file_io.Query(&info, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Query", rv); @@ -290,7 +290,7 @@ std::string TestFileIO::TestTouchQuery() { // Call |Query()| again, to make sure it works a second time. rv = file_io.Query(&info, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Query", rv); @@ -304,7 +304,7 @@ std::string TestFileIO::TestAbortCalls() { pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); pp::FileRef_Dev file_ref(file_system, "/file_abort_calls"); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -315,7 +315,7 @@ std::string TestFileIO::TestAbortCalls() { rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -336,7 +336,7 @@ std::string TestFileIO::TestAbortCalls() { .Open(file_ref, PP_FILEOPENFLAG_READ,callback); if (callback.run_count() > 0) return "FileIO::Open ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileIO::Open not aborted."; @@ -351,7 +351,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -359,7 +359,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.Query(&info, callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Save a copy and make sure |info| doesn't get written to. PP_FileInfo_Dev info_copy; memcpy(&info_copy, &info, sizeof(info)); @@ -378,7 +378,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -386,7 +386,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.Touch(0, 0, callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileIO::Touch not aborted."; @@ -401,7 +401,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -409,7 +409,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.Read(0, buf, sizeof(buf), callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Save a copy and make sure |buf| doesn't get written to. char buf_copy[3]; memcpy(&buf_copy, &buf, sizeof(buf)); @@ -429,7 +429,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -437,7 +437,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.Write(0, buf, sizeof(buf), callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileIO::Write not aborted."; @@ -451,7 +451,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -459,7 +459,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.SetLength(3, callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileIO::SetLength not aborted."; @@ -473,7 +473,7 @@ std::string TestFileIO::TestAbortCalls() { { pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -481,7 +481,7 @@ std::string TestFileIO::TestAbortCalls() { callback.reset_run_count(); rv = file_io.Flush(callback); } // Destroy |file_io|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileIO::Flush not aborted."; diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc index 1596333..c448927 100644 --- a/ppapi/tests/test_file_ref.cc +++ b/ppapi/tests/test_file_ref.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -76,7 +76,7 @@ std::string TestFileRef::TestGetFileSystemType() { pp::URLLoader loader(instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return "URLLoader::Open() failed."; @@ -125,7 +125,7 @@ std::string TestFileRef::TestGetName() { pp::URLLoader loader(instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return "URLLoader::Open() failed."; @@ -169,7 +169,7 @@ std::string TestFileRef::TestGetPath() { pp::URLLoader loader(instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return "URLLoader::Open() failed."; @@ -224,7 +224,7 @@ std::string TestFileRef::TestGetParent() { pp::URLLoader loader(instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return "URLLoader::Open() failed."; @@ -249,7 +249,7 @@ std::string TestFileRef::TestMakeDirectory() { // Open. pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -257,7 +257,7 @@ std::string TestFileRef::TestMakeDirectory() { // MakeDirectory. pp::FileRef_Dev dir_ref(file_system, "/test_dir_make_directory"); rv = dir_ref.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectory", rv); @@ -268,7 +268,7 @@ std::string TestFileRef::TestMakeDirectory() { .MakeDirectory(callback); if (callback.run_count() > 0) return "FileSystem::MakeDirectory ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::MakeDirectory not aborted."; @@ -279,7 +279,7 @@ std::string TestFileRef::TestMakeDirectory() { // MakeDirectoryIncludingAncestors. dir_ref = pp::FileRef_Dev(file_system, "/dir_make_dir_1/dir_make_dir_2"); rv = dir_ref.MakeDirectoryIncludingAncestors(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectoryIncludingAncestors", rv); @@ -292,7 +292,7 @@ std::string TestFileRef::TestMakeDirectory() { return "FileSystem::MakeDirectoryIncludingAncestors " "ran callback synchronously."; } - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::MakeDirectoryIncludingAncestors not aborted."; @@ -303,7 +303,7 @@ std::string TestFileRef::TestMakeDirectory() { // MakeDirectory with nested path. dir_ref = pp::FileRef_Dev(file_system, "/dir_make_dir_3/dir_make_dir_4"); rv = dir_ref.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv == PP_OK) { return "Calling FileSystem::MakeDirectory() with a nested directory path " @@ -317,7 +317,7 @@ std::string TestFileRef::TestQueryAndTouchFile() { TestCompletionCallback callback(instance_->pp_instance()); pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -327,14 +327,14 @@ std::string TestFileRef::TestQueryAndTouchFile() { rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); // Write some data to have a non-zero file size. rv = file_io.Write(0, "test", 4, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != 4) return ReportError("FileIO::Write", rv); @@ -345,7 +345,7 @@ std::string TestFileRef::TestQueryAndTouchFile() { const PP_Time last_access_time = 123 * 24 * 3600.0; const PP_Time last_modified_time = 246.0; rv = file_ref.Touch(last_access_time, last_modified_time, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Touch", rv); @@ -356,7 +356,7 @@ std::string TestFileRef::TestQueryAndTouchFile() { .Touch(last_access_time, last_modified_time, callback); if (callback.run_count() > 0) return "FileSystem::Touch ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::Touch not aborted."; @@ -367,7 +367,7 @@ std::string TestFileRef::TestQueryAndTouchFile() { // Query. PP_FileInfo_Dev info; rv = file_io.Query(&info, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Query", rv); @@ -387,7 +387,7 @@ std::string TestFileRef::TestQueryAndTouchFile() { last_access_time, last_modified_time, callback); if (callback.run_count() > 0) return "FileSystem::Touch ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::Touch not aborted."; @@ -402,7 +402,7 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { TestCompletionCallback callback(instance_->pp_instance()); pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -410,33 +410,33 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { pp::FileRef_Dev file_ref(file_system, "/file_delete"); pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); rv = file_ref.Delete(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Delete", rv); pp::FileRef_Dev dir_ref(file_system, "/dir_delete"); rv = dir_ref.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectory", rv); rv = dir_ref.Delete(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Delete", rv); pp::FileRef_Dev nested_dir_ref(file_system, "/dir_delete_1/dir_delete_2"); rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectoryIncludingAncestors", rv); @@ -444,14 +444,14 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { // Hang on to a ref to the parent; otherwise the callback will be aborted. pp::FileRef_Dev parent_dir_ref = nested_dir_ref.GetParent(); rv = parent_dir_ref.Delete(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_ERROR_FAILED) return ReportError("FileSystem::Delete", rv); pp::FileRef_Dev nonexistent_file_ref(file_system, "/nonexistent_file_delete"); rv = nonexistent_file_ref.Delete(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_ERROR_FILENOTFOUND) return ReportError("FileSystem::Delete", rv); @@ -461,7 +461,7 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { pp::FileRef_Dev file_ref_abort(file_system, "/file_delete_abort"); pp::FileIO_Dev file_io_abort(instance_); rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -471,7 +471,7 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { } if (callback.run_count() > 0) return "FileSystem::Delete ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::Delete not aborted."; @@ -486,7 +486,7 @@ std::string TestFileRef::TestRenameFileAndDirectory() { TestCompletionCallback callback(instance_->pp_instance()); pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -494,42 +494,42 @@ std::string TestFileRef::TestRenameFileAndDirectory() { pp::FileRef_Dev file_ref(file_system, "/file_rename"); pp::FileIO_Dev file_io(instance_); rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); pp::FileRef_Dev target_file_ref(file_system, "/target_file_rename"); rv = file_ref.Rename(target_file_ref, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Rename", rv); pp::FileRef_Dev dir_ref(file_system, "/dir_rename"); rv = dir_ref.MakeDirectory(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectory", rv); pp::FileRef_Dev target_dir_ref(file_system, "/target_dir_rename"); rv = dir_ref.Rename(target_dir_ref, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Rename", rv); pp::FileRef_Dev nested_dir_ref(file_system, "/dir_rename_1/dir_rename_2"); rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::MakeDirectoryIncludingAncestors", rv); pp::FileRef_Dev target_nested_dir_ref(file_system, "/dir_rename_1"); rv = nested_dir_ref.Rename(target_nested_dir_ref, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_ERROR_FAILED) return ReportError("FileSystem::Rename", rv); @@ -543,7 +543,7 @@ std::string TestFileRef::TestRenameFileAndDirectory() { pp::FileRef_Dev file_ref_abort(file_system, "/file_rename_abort"); pp::FileIO_Dev file_io_abort(instance_); rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -553,7 +553,7 @@ std::string TestFileRef::TestRenameFileAndDirectory() { } if (callback.run_count() > 0) return "FileSystem::Rename ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::Rename not aborted."; diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc index 958f896..7758f5f 100644 --- a/ppapi/tests/test_file_system.cc +++ b/ppapi/tests/test_file_system.cc @@ -28,7 +28,7 @@ std::string TestFileSystem::TestOpen() { // Open. pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); int32_t rv = file_system.Open(1024, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileSystem::Open", rv); @@ -39,7 +39,7 @@ std::string TestFileSystem::TestOpen() { .Open(1024, callback); if (callback.run_count() > 0) return "FileSystem::Open ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "FileSystem::Open not aborted."; @@ -61,17 +61,17 @@ std::string TestFileSystem::TestMultipleOpens() { TestCompletionCallback callback_2(instance_->pp_instance()); int32_t rv_2 = file_system.Open(1024, callback_2); - if (rv_2 == PP_ERROR_WOULDBLOCK || rv_2 == PP_OK) + if (rv_2 == PP_OK_COMPLETIONPENDING || rv_2 == PP_OK) return "FileSystem::Open should not allow multiple opens."; - if (rv_1 == PP_ERROR_WOULDBLOCK) + if (rv_1 == PP_OK_COMPLETIONPENDING) rv_1 = callback_1.WaitForResult(); if (rv_1 != PP_OK) return ReportError("FileSystem::Open", rv_1); TestCompletionCallback callback_3(instance_->pp_instance()); int32_t rv_3 = file_system.Open(1024, callback_3); - if (rv_3 == PP_ERROR_WOULDBLOCK || rv_3 == PP_OK) + if (rv_3 == PP_OK_COMPLETIONPENDING || rv_3 == PP_OK) return "FileSystem::Open should not allow multiple opens."; PASS(); diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc index f9bafc1..6c484b9 100644 --- a/ppapi/tests/test_graphics_2d.cc +++ b/ppapi/tests/test_graphics_2d.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -92,7 +92,7 @@ bool TestGraphics2D::FlushAndWaitForDone(pp::Graphics2D* context) { int32_t rv = context->Flush(cc); if (rv == PP_OK) return true; - if (rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK_COMPLETIONPENDING) return false; testing_interface_->RunMessageLoop(instance_->pp_instance()); return true; @@ -524,7 +524,7 @@ std::string TestGraphics2D::TestFlush() { dc.PaintImageData(background, pp::Point(0, 0)); int32_t rv = dc.Flush(pp::CompletionCallback::Block()); - if (rv == PP_OK || rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) return "Flush succeeded from the main thread with no callback."; // Test flushing with no operations still issues a callback. @@ -537,13 +537,13 @@ std::string TestGraphics2D::TestFlush() { // Test that multiple flushes fail if we don't get a callback in between. rv = dc_nopaints.Flush(pp::CompletionCallback(&FlushCallbackNOP, NULL)); - if (rv != PP_OK && rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK && rv != PP_OK_COMPLETIONPENDING) return "Couldn't flush first time for multiple flush test."; if (rv != PP_OK) { // If the first flush would block, then a second should fail. rv = dc_nopaints.Flush(pp::CompletionCallback(&FlushCallbackNOP, NULL)); - if (rv == PP_OK || rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) return "Second flush succeeded before callback ran."; } diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc index 72ead1b..4035676 100644 --- a/ppapi/tests/test_transport.cc +++ b/ppapi/tests/test_transport.cc @@ -36,17 +36,17 @@ std::string TestTransport::TestBasics() { TestCompletionCallback connect_cb1(instance_->pp_instance()); TestCompletionCallback connect_cb2(instance_->pp_instance()); - ASSERT_EQ(transport1.Connect(connect_cb1), PP_ERROR_WOULDBLOCK); - ASSERT_EQ(transport2.Connect(connect_cb2), PP_ERROR_WOULDBLOCK); + ASSERT_EQ(transport1.Connect(connect_cb1), PP_OK_COMPLETIONPENDING); + ASSERT_EQ(transport2.Connect(connect_cb2), PP_OK_COMPLETIONPENDING); pp::Var address1; pp::Var address2; TestCompletionCallback next_address_cb1(instance_->pp_instance()); TestCompletionCallback next_address_cb2(instance_->pp_instance()); ASSERT_EQ(transport1.GetNextAddress(&address1, next_address_cb1), - PP_ERROR_WOULDBLOCK); + PP_OK_COMPLETIONPENDING); ASSERT_EQ(transport2.GetNextAddress(&address2, next_address_cb2), - PP_ERROR_WOULDBLOCK); + PP_OK_COMPLETIONPENDING); ASSERT_EQ(next_address_cb1.WaitForResult(), 0); ASSERT_EQ(next_address_cb2.WaitForResult(), 0); ASSERT_EQ(transport1.GetNextAddress(&address1, next_address_cb1), PP_OK); diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc index 2b606c2..1faacfc 100644 --- a/ppapi/tests/test_url_loader.cc +++ b/ppapi/tests/test_url_loader.cc @@ -62,7 +62,7 @@ std::string TestURLLoader::ReadEntireFile(pp::FileIO_Dev* file_io, for (;;) { int32_t rv = file_io->Read(offset, buf, sizeof(buf), callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv < 0) return ReportError("FileIO::Read", rv); @@ -82,7 +82,7 @@ std::string TestURLLoader::ReadEntireResponseBody(pp::URLLoader* loader, for (;;) { int32_t rv = loader->ReadResponseBody(buf, sizeof(buf), callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv < 0) return ReportError("URLLoader::ReadResponseBody", rv); @@ -101,7 +101,7 @@ std::string TestURLLoader::LoadAndCompareBody( pp::URLLoader loader(*instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("URLLoader::Open", rv); @@ -198,7 +198,7 @@ std::string TestURLLoader::TestStreamToFile() { pp::URLLoader loader(*instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("URLLoader::Open", rv); @@ -215,7 +215,7 @@ std::string TestURLLoader::TestStreamToFile() { return "URLResponseInfo::GetBody returned null"; rv = loader.FinishStreamingToFile(callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("URLLoader::FinishStreamingToFile", rv); @@ -223,7 +223,7 @@ std::string TestURLLoader::TestStreamToFile() { pp::FileIO_Dev reader; rv = reader.Open(body, PP_FILEOPENFLAG_READ, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("FileIO::Open", rv); @@ -255,7 +255,7 @@ std::string TestURLLoader::TestSameOriginRestriction() { pp::URLLoader loader(*instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); // We expect a failure. @@ -282,7 +282,7 @@ std::string TestURLLoader::TestAuditURLRedirect() { pp::URLLoader loader(*instance_); int32_t rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("URLLoader::Open", rv); @@ -314,7 +314,7 @@ std::string TestURLLoader::TestAbortCalls() { rv = pp::URLLoader(*instance_).Open(request, callback); if (callback.run_count() > 0) return "URLLoader::Open ran callback synchronously."; - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { rv = callback.WaitForResult(); if (rv != PP_ERROR_ABORTED) return "URLLoader::Open not aborted."; @@ -329,7 +329,7 @@ std::string TestURLLoader::TestAbortCalls() { { pp::URLLoader loader(*instance_); rv = loader.Open(request, callback); - if (rv == PP_ERROR_WOULDBLOCK) + if (rv == PP_OK_COMPLETIONPENDING) rv = callback.WaitForResult(); if (rv != PP_OK) return ReportError("URLLoader::Open", rv); @@ -337,7 +337,7 @@ std::string TestURLLoader::TestAbortCalls() { callback.reset_run_count(); rv = loader.ReadResponseBody(buf, sizeof(buf), callback); } // Destroy |loader|. - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Save a copy and make sure |buf| doesn't get written to. char buf_copy[2]; memcpy(&buf_copy, &buf, sizeof(buf)); diff --git a/ppapi/tests/test_utils.cc b/ppapi/tests/test_utils.cc index fcaff40..622c758 100644 --- a/ppapi/tests/test_utils.cc +++ b/ppapi/tests/test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,14 +27,14 @@ std::string ReportError(const char* method, int32_t error) { } TestCompletionCallback::TestCompletionCallback(PP_Instance instance) - : result_(PP_ERROR_WOULDBLOCK), + : result_(PP_OK_COMPLETIONPENDING), post_quit_task_(false), run_count_(0), instance_(instance) { } int32_t TestCompletionCallback::WaitForResult() { - result_ = PP_ERROR_WOULDBLOCK; // Reset + result_ = PP_OK_COMPLETIONPENDING; // Reset post_quit_task_ = true; GetTestingInterface()->RunMessageLoop(instance_); return result_; diff --git a/remoting/client/plugin/pepper_port_allocator_session.cc b/remoting/client/plugin/pepper_port_allocator_session.cc index 96489eb..8c5c598 100644 --- a/remoting/client/plugin/pepper_port_allocator_session.cc +++ b/remoting/client/plugin/pepper_port_allocator_session.cc @@ -123,7 +123,7 @@ class PepperURLFetcher { pp::CompletionCallback callback = callback_factory_.NewCallback(&PepperURLFetcher::DidOpen); int rv = loader_.Open(request, callback); - if (rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK_COMPLETIONPENDING) callback.Run(rv); } @@ -132,7 +132,7 @@ class PepperURLFetcher { pp::CompletionCallback callback = callback_factory_.NewCallback(&PepperURLFetcher::DidRead); int rv = loader_.ReadResponseBody(buf_, sizeof(buf_), callback); - if (rv != PP_ERROR_WOULDBLOCK) + if (rv != PP_OK_COMPLETIONPENDING) callback.Run(rv); } diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index a166c14..d469860 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -129,13 +129,13 @@ base::MessageLoopProxy* GetMainThreadMessageLoop() { void AddRefResource(PP_Resource resource) { if (!ResourceTracker::Get()->AddRefResource(resource)) { - DLOG(WARNING) << "AddRefResource()ing a nonexistent resource"; + DLOG(WARNING) << "AddRefResource()ing a nonexistent resource " << resource; } } void ReleaseResource(PP_Resource resource) { if (!ResourceTracker::Get()->UnrefResource(resource)) { - DLOG(WARNING) << "ReleaseResource()ing a nonexistent resource"; + DLOG(WARNING) << "ReleaseResource()ing a nonexistent resource " << resource; } } @@ -539,4 +539,3 @@ bool PluginModule::InitializeModule() { } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_audio_impl.cc b/webkit/plugins/ppapi/ppb_audio_impl.cc index 0d4f852..54de09c 100644 --- a/webkit/plugins/ppapi/ppb_audio_impl.cc +++ b/webkit/plugins/ppapi/ppb_audio_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -310,7 +310,7 @@ int32_t PPB_Audio_Impl::Open(PluginDelegate* plugin_delegate, // once and only once. create_callback_ = create_callback; create_callback_pending_ = true; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_Audio_Impl::GetSyncSocket(int* sync_socket) { @@ -373,4 +373,3 @@ void PPB_Audio_Impl::StreamCreated( } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_broker_impl.cc b/webkit/plugins/ppapi/ppb_broker_impl.cc index d214c7b..9e0cb5c 100644 --- a/webkit/plugins/ppapi/ppb_broker_impl.cc +++ b/webkit/plugins/ppapi/ppb_broker_impl.cc @@ -103,7 +103,7 @@ int32_t PPB_Broker_Impl::Connect( connect_callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, connect_callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) { diff --git a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc index 36e43bf..e704b3f 100644 --- a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc +++ b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -119,7 +119,7 @@ int32_t PPB_DirectoryReader_Impl::GetNextEntry( callback, NULL, NULL, this))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PPB_DirectoryReader_Impl::AddNewEntries( @@ -168,4 +168,3 @@ bool PPB_DirectoryReader_Impl::FillUpEntry() { } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_file_chooser_impl.cc b/webkit/plugins/ppapi/ppb_file_chooser_impl.cc index 702f107..817dcd5 100644 --- a/webkit/plugins/ppapi/ppb_file_chooser_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_chooser_impl.cc @@ -194,7 +194,7 @@ int32_t PPB_FileChooser_Impl::Show(const PP_CompletionCallback& callback) { return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } scoped_refptr<PPB_FileRef_Impl> PPB_FileChooser_Impl::GetNextChosenFile() { diff --git a/webkit/plugins/ppapi/ppb_file_chooser_impl.h b/webkit/plugins/ppapi/ppb_file_chooser_impl.h index 75923a1..57d1d32 100644 --- a/webkit/plugins/ppapi/ppb_file_chooser_impl.h +++ b/webkit/plugins/ppapi/ppb_file_chooser_impl.h @@ -43,7 +43,7 @@ class PPB_FileChooser_Impl : public Resource { int32_t ValidateCallback(const PP_CompletionCallback& callback); // Sets up |callback| as the pending callback. This should only be called once - // it is certain that |PP_ERROR_WOULDBLOCK| will be returned. + // it is certain that |PP_OK_COMPLETIONPENDING| will be returned. void RegisterCallback(const PP_CompletionCallback& callback); void RunCallback(int32_t result); diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.cc b/webkit/plugins/ppapi/ppb_file_io_impl.cc index 6597aee..624ced4 100644 --- a/webkit/plugins/ppapi/ppb_file_io_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_io_impl.cc @@ -262,7 +262,7 @@ int32_t PPB_FileIO_Impl::Open(PPB_FileRef_Impl* file_ref, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::Query(PP_FileInfo_Dev* info, @@ -283,7 +283,7 @@ int32_t PPB_FileIO_Impl::Query(PP_FileInfo_Dev* info, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time, @@ -301,7 +301,7 @@ int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::Read(int64_t offset, @@ -323,7 +323,7 @@ int32_t PPB_FileIO_Impl::Read(int64_t offset, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::Write(int64_t offset, @@ -341,7 +341,7 @@ int32_t PPB_FileIO_Impl::Write(int64_t offset, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::SetLength(int64_t length, @@ -357,7 +357,7 @@ int32_t PPB_FileIO_Impl::SetLength(int64_t length, return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) { @@ -371,7 +371,7 @@ int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) { return PP_ERROR_FAILED; RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PPB_FileIO_Impl::Close() { diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.h b/webkit/plugins/ppapi/ppb_file_io_impl.h index 7fe5f46..621aa1e 100644 --- a/webkit/plugins/ppapi/ppb_file_io_impl.h +++ b/webkit/plugins/ppapi/ppb_file_io_impl.h @@ -84,7 +84,7 @@ class PPB_FileIO_Impl : public Resource { PP_CompletionCallback callback); // Sets up |callback| as the pending callback. This should only be called once - // it is certain that |PP_ERROR_WOULDBLOCK| will be returned. + // it is certain that |PP_OK_COMPLETIONPENDING| will be returned. void RegisterCallback(PP_CompletionCallback callback); void RunPendingCallback(int32_t result); diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc index 55bf3f1..c2ec5b2 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -131,7 +131,7 @@ int32_t MakeDirectory(PP_Resource directory_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Touch(PP_Resource file_ref_id, @@ -156,7 +156,7 @@ int32_t Touch(PP_Resource file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Delete(PP_Resource file_ref_id, @@ -178,7 +178,7 @@ int32_t Delete(PP_Resource file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t Rename(PP_Resource file_ref_id, @@ -209,7 +209,7 @@ int32_t Rename(PP_Resource file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } const PPB_FileRef_Dev ppb_fileref = { @@ -340,4 +340,3 @@ FilePath PPB_FileRef_Impl::GetSystemPath() const { } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.cc b/webkit/plugins/ppapi/ppb_file_system_impl.cc index a41c4cc..0f4793c 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_system_impl.cc @@ -77,7 +77,7 @@ int32_t Open(PP_Resource file_system_id, callback, NULL, file_system, NULL))) return PP_ERROR_FAILED; - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } PP_FileSystemType_Dev GetType(PP_Resource resource) { diff --git a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc index d147996..f21a597 100644 --- a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc @@ -177,7 +177,7 @@ int32_t PPB_Flash_Menu_Impl::Show(const PP_Point* location, int32_t rv = instance()->delegate()->ShowContextMenu( instance(), this, gfx::Point(location->x, location->y)); - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Record callback and output buffers. callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); diff --git a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc index c817c8e..a136003 100644 --- a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc @@ -114,7 +114,7 @@ int32_t PPB_Flash_NetConnector_Impl::ConnectTcp( } int32_t rv = instance()->delegate()->ConnectTcp(this, host, port); - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Record callback and output buffers. callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); @@ -153,7 +153,7 @@ int32_t PPB_Flash_NetConnector_Impl::ConnectTcpAddress( } int32_t rv = instance()->delegate()->ConnectTcpAddress(this, addr); - if (rv == PP_ERROR_WOULDBLOCK) { + if (rv == PP_OK_COMPLETIONPENDING) { // Record callback and output buffers. callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc index 1bb83ee..c1b6ab9 100644 --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -399,7 +399,7 @@ int32_t PPB_Graphics2D_Impl::Flush(const PP_CompletionCallback& callback) { } else { unpainted_flush_callback_.Set(callback); } - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image, diff --git a/webkit/plugins/ppapi/ppb_surface_3d_impl.cc b/webkit/plugins/ppapi/ppb_surface_3d_impl.cc index e48b1d5..b735c1d 100644 --- a/webkit/plugins/ppapi/ppb_surface_3d_impl.cc +++ b/webkit/plugins/ppapi/ppb_surface_3d_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -145,7 +145,7 @@ int32_t PPB_Surface3D_Impl::SwapBuffers(PP_CompletionCallback callback) { if (impl) { context_->gles2_impl()->SwapBuffers(); } - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PPB_Surface3D_Impl::ViewInitiatedPaint() { @@ -202,4 +202,3 @@ void PPB_Surface3D_Impl::SendContextLost() { } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc index 0022014..c4d440e 100644 --- a/webkit/plugins/ppapi/ppb_transport_impl.cc +++ b/webkit/plugins/ppapi/ppb_transport_impl.cc @@ -154,7 +154,7 @@ int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { CHECK(resource_id); connect_callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_Transport_Impl::GetNextAddress(PP_Var* address, @@ -172,7 +172,7 @@ int32_t PPB_Transport_Impl::GetNextAddress(PP_Var* address, CHECK(resource_id); next_address_callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { @@ -200,7 +200,7 @@ int32_t PPB_Transport_Impl::Recv(void* data, uint32_t len, CHECK(resource_id); recv_callback_ = new TrackedCompletionCallback( instance()->module()->GetCallbackTracker(), resource_id, callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_Transport_Impl::Send(const void* data, uint32_t len, diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc index 31518d1..bb2621e 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc @@ -205,7 +205,7 @@ PPB_URLLoader_Impl::PPB_URLLoader_Impl(PluginInstance* instance, total_bytes_to_be_received_(-1), user_buffer_(NULL), user_buffer_size_(0), - done_status_(PP_ERROR_WOULDBLOCK), + done_status_(PP_OK_COMPLETIONPENDING), has_universal_access_(false), status_callback_(NULL) { } @@ -267,7 +267,7 @@ int32_t PPB_URLLoader_Impl::Open(PPB_URLRequestInfo_Impl* request, // Notify completion when we receive a redirect or response headers. RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_URLLoader_Impl::FollowRedirect(PP_CompletionCallback callback) { @@ -283,7 +283,7 @@ int32_t PPB_URLLoader_Impl::FollowRedirect(PP_CompletionCallback callback) { loader_->setDefersLoading(false); // Allow the redirect to continue. RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } bool PPB_URLLoader_Impl::GetUploadProgress(int64_t* bytes_sent, @@ -329,14 +329,14 @@ int32_t PPB_URLLoader_Impl::ReadResponseBody(void* buffer, return FillUserBuffer(); // We may have already reached EOF. - if (done_status_ != PP_ERROR_WOULDBLOCK) { + if (done_status_ != PP_OK_COMPLETIONPENDING) { user_buffer_ = NULL; user_buffer_size_ = 0; return done_status_; } RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } int32_t PPB_URLLoader_Impl::FinishStreamingToFile( @@ -348,12 +348,12 @@ int32_t PPB_URLLoader_Impl::FinishStreamingToFile( return PP_ERROR_FAILED; // We may have already reached EOF. - if (done_status_ != PP_ERROR_WOULDBLOCK) + if (done_status_ != PP_OK_COMPLETIONPENDING) return done_status_; // Wait for didFinishLoading / didFail. RegisterCallback(callback); - return PP_ERROR_WOULDBLOCK; + return PP_OK_COMPLETIONPENDING; } void PPB_URLLoader_Impl::Close() { diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.h b/webkit/plugins/ppapi/ppb_url_loader_impl.h index cd21285..3bc8dc1 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.h +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h @@ -95,7 +95,7 @@ class PPB_URLLoader_Impl : public Resource, public WebKit::WebURLLoaderClient { int32_t ValidateCallback(PP_CompletionCallback callback); // Sets up |callback| as the pending callback. This should only be called once - // it is certain that |PP_ERROR_WOULDBLOCK| will be returned. + // it is certain that |PP_OK_COMPLETIONPENDING| will be returned. void RegisterCallback(PP_CompletionCallback callback); void RunCallback(int32_t result); |