summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 20:10:55 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 20:10:55 +0000
commite655a951994dcafb7203d6824b90dfef6e445dca (patch)
tree18b9126b21efd9e63f74149263753031ec393ae8 /ppapi/native_client
parentc96312d46205ea82764aba6255ecbb8dd5f57d11 (diff)
downloadchromium_src-e655a951994dcafb7203d6824b90dfef6e445dca.zip
chromium_src-e655a951994dcafb7203d6824b90dfef6e445dca.tar.gz
chromium_src-e655a951994dcafb7203d6824b90dfef6e445dca.tar.bz2
Add a new error code for a null callback on the main thread.
Convert the NaCl and ChromeIPC proxies to use the new value. Review URL: http://codereview.chromium.org/7885014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc14
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc2
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc2
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc8
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc2
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.cc2
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_url_loader/ppapi_ppb_url_loader.cc2
9 files changed, 20 insertions, 20 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc
index 1099ec1..4c8758c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc
@@ -24,10 +24,10 @@ int32_t StreamAsFile(PP_Instance instance,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0)
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
NaClSrpcError srpc_result = NaClFileRpcClient::StreamAsFile(
- GetMainSrpcChannel(), instance, const_cast<char*>(url), callback_id);
+ GetMainSrpcChannel(), instance, const_cast<char*>(url), callback_id);
DebugPrintf("NaClFile::StreamAsFile: %s\n", NaClSrpcErrorString(srpc_result));
if (srpc_result == NACL_SRPC_RESULT_OK)
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc
index 848b1ee..9f4851e 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc
@@ -66,7 +66,7 @@ int32_t Open(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
@@ -90,7 +90,7 @@ int32_t Query(PP_Resource file_io,
struct PP_CompletionCallback callback) {
DebugPrintf("PPB_FileIO::Query: file_io=%"NACL_PRIu32"\n", file_io);
if (callback.func == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(
callback, reinterpret_cast<char*>(info));
@@ -130,7 +130,7 @@ int32_t Touch(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error = PP_ERROR_FAILED;
@@ -165,7 +165,7 @@ int32_t Read(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback, buffer);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error_or_bytes;
NaClSrpcError srpc_result =
@@ -202,7 +202,7 @@ int32_t Write(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error_or_bytes = PP_ERROR_FAILED;
NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Write(
@@ -231,7 +231,7 @@ int32_t SetLength(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error = PP_ERROR_FAILED;
NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_SetLength(
@@ -256,7 +256,7 @@ int32_t Flush(PP_Resource file_io,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error = PP_ERROR_FAILED;
NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Flush(
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc
index 64ebaf5..fb4fa40 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.cc
@@ -57,8 +57,8 @@ int32_t Open(PP_Resource file_system,
DebugPrintf("PPB_FileSystem::Open: file_system=%"NACL_PRIu32"\n",
file_system);
int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
- if (callback_id == 0)
- return PP_ERROR_BADARGUMENT;
+ if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc
index 3bab6d1..2bf2797 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.cc
@@ -153,7 +153,7 @@ int32_t Flush(PP_Resource graphics_2d,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
index 974563a..736eee2 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
@@ -238,7 +238,7 @@ int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id,
int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError retval =
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc
index 2118e90..be7a639 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.cc
@@ -60,7 +60,7 @@ int32_t Open(PP_Resource loader,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
@@ -80,7 +80,7 @@ int32_t FollowRedirect(PP_Resource loader,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
@@ -167,7 +167,7 @@ int32_t ReadResponseBody(PP_Resource loader,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback, buffer);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error_or_bytes;
NaClSrpcError srpc_result =
@@ -195,7 +195,7 @@ int32_t FinishStreamingToFile(PP_Resource loader,
int32_t callback_id =
CompletionCallbackTable::Get()->AddCallback(callback);
if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_BLOCKS_MAIN_THREAD;
int32_t pp_error;
NaClSrpcError srpc_result =
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc
index 5d17cde..ebf8128 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc
@@ -134,7 +134,7 @@ void TestOpen() {
pp_error = ppb_file_system->Open(file_system, kSize,
PP_BlockUntilComplete());
ppb_core->ReleaseResource(file_system);
- EXPECT(pp_error == PP_ERROR_BADARGUMENT);
+ EXPECT(pp_error == PP_ERROR_BLOCKS_MAIN_THREAD);
#endif
// Test success for asynchronous open.
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.cc b/ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.cc
index cedeead..c8b4007 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.cc
@@ -486,7 +486,7 @@ void TestFlush() {
// Invalid args -> PP_ERROR_BAD..., no callback.
EXPECT(PP_ERROR_BADRESOURCE == PPBGraphics2D()->Flush(kInvalidResource, cc));
EXPECT(PP_ERROR_BADRESOURCE == PPBGraphics2D()->Flush(kNotAResource, cc));
- EXPECT(PP_ERROR_BADARGUMENT ==
+ EXPECT(PP_ERROR_BLOCKS_MAIN_THREAD ==
PPBGraphics2D()->Flush(graphics2d, PP_BlockUntilComplete()));
// Valid args -> PP_OK_COMPLETIONPENDING, expect callback.
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_url_loader/ppapi_ppb_url_loader.cc b/ppapi/native_client/tests/ppapi_browser/ppb_url_loader/ppapi_ppb_url_loader.cc
index 1c5d30f..70d4d93 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_url_loader/ppapi_ppb_url_loader.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_url_loader/ppapi_ppb_url_loader.cc
@@ -407,7 +407,7 @@ void TestOpenSimple() {
loader = PPBURLLoader()->Create(pp_instance());
// We are on the main thread, performing a sync call should fail
rv = PPBURLLoader()->Open(loader, request, PP_BlockUntilComplete());
- EXPECT(PP_ERROR_BADARGUMENT == rv);
+ EXPECT(PP_ERROR_BLOCKS_MAIN_THREAD == rv);
PPBCore()->ReleaseResource(loader);
LOG_TO_BROWSER("open (asynchronous) normal");