summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/file_io.cc
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 21:42:37 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 21:42:37 +0000
commit917e86adc3f824f518c999dcba20bfd4cbf18a18 (patch)
tree52fe38f61527360231c17a905015066fb5d34bba /ppapi/cpp/file_io.cc
parent9ae7b9195f0e06b64664bba52e9cc0e8b3470f56 (diff)
downloadchromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.zip
chromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.tar.gz
chromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.tar.bz2
Add a flag field to PP_CompletionCallback to control if the callback should
always be invoked asynchronously on success or error or skipped if the operation can complete synchronously without blocking. Keep the default behavior as-is until clients update their code. Bump revisions of all interfaces that take callbacks as args. Update browser interface function implementations and C++ layer to force callbacks if sync option is not set. Change ppapi/tests to run tests involving callbacks with both flag options. BUG=79376 TEST=ppapi_tests + bots Review URL: http://codereview.chromium.org/6899055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/file_io.cc')
-rw-r--r--ppapi/cpp/file_io.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/ppapi/cpp/file_io.cc b/ppapi/cpp/file_io.cc
index ca6760b..85c3051 100644
--- a/ppapi/cpp/file_io.cc
+++ b/ppapi/cpp/file_io.cc
@@ -41,7 +41,7 @@ int32_t FileIO::Open(const FileRef& file_ref,
int32_t open_flags,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Open(
pp_resource(), file_ref.pp_resource(), open_flags,
cc.pp_completion_callback());
@@ -50,7 +50,7 @@ int32_t FileIO::Open(const FileRef& file_ref,
int32_t FileIO::Query(PP_FileInfo* result_buf,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Query(
pp_resource(), result_buf, cc.pp_completion_callback());
}
@@ -59,7 +59,7 @@ int32_t FileIO::Touch(PP_Time last_access_time,
PP_Time last_modified_time,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Touch(
pp_resource(), last_access_time, last_modified_time,
cc.pp_completion_callback());
@@ -70,7 +70,7 @@ int32_t FileIO::Read(int64_t offset,
int32_t bytes_to_read,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Read(pp_resource(),
offset, buffer, bytes_to_read, cc.pp_completion_callback());
}
@@ -80,7 +80,7 @@ int32_t FileIO::Write(int64_t offset,
int32_t bytes_to_write,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Write(
pp_resource(), offset, buffer, bytes_to_write,
cc.pp_completion_callback());
@@ -89,14 +89,14 @@ int32_t FileIO::Write(int64_t offset,
int32_t FileIO::SetLength(int64_t length,
const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->SetLength(
pp_resource(), length, cc.pp_completion_callback());
}
int32_t FileIO::Flush(const CompletionCallback& cc) {
if (!has_interface<PPB_FileIO>())
- return PP_ERROR_NOINTERFACE;
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_FileIO>()->Flush(
pp_resource(), cc.pp_completion_callback());
}