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

Unified Diff: ppapi/proxy/error_conversion.cc

Issue 22923014: TCPSockets are switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/error_conversion.cc
diff --git a/ppapi/host/error_conversion.cc b/ppapi/proxy/error_conversion.cc
similarity index 80%
rename from ppapi/host/error_conversion.cc
rename to ppapi/proxy/error_conversion.cc
index da985d399661ae82a03b4050bb3ff1f5a03a0088..b842e67771f5c1c649ad9f4eede7ba7f03293b74 100644
--- a/ppapi/host/error_conversion.cc
+++ b/ppapi/proxy/error_conversion.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ppapi/host/error_conversion.h"
+#include "ppapi/proxy/error_conversion.h"
#include "base/safe_numerics.h"
#include "net/base/net_errors.h"
#include "ppapi/c/pp_errors.h"
namespace ppapi {
-namespace host {
+namespace proxy {
int32_t NetErrorToPepperError(int net_error) {
if (net_error > 0)
@@ -71,5 +71,18 @@ int32_t NetErrorToPepperError(int net_error) {
}
}
-} // namespace host
+int32_t ConvertNetworkAPIErrorForCompatibility(int32_t pp_error,
+ bool private_api) {
+ // The private API doesn't return network-specific error codes or
+ // PP_ERROR_NOACCESS. In order to preserve the behavior, we convert those to
+ // PP_ERROR_FAILED.
+ if (private_api &&
+ (pp_error <= PP_ERROR_CONNECTION_CLOSED ||
+ pp_error == PP_ERROR_NOACCESS)) {
+ return PP_ERROR_FAILED;
+ }
+ return pp_error;
+}
+
+} // namespace proxy
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698