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

Side by Side Diff: ppapi/host/error_conversion.cc

Issue 16959005: Implement PPB_UDPSocket_Dev: part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: In response to Cris's suggestions: not using base::ListValue; check conversoin in NetErrorToPepperE… Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/host/error_conversion.h" 5 #include "ppapi/host/error_conversion.h"
6 6
7 #include <limits>
8
9 #include "base/logging.h"
7 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
8 #include "ppapi/c/pp_errors.h" 11 #include "ppapi/c/pp_errors.h"
9 12
10 namespace ppapi { 13 namespace ppapi {
11 namespace host { 14 namespace host {
12 15
13 int32_t NetErrorToPepperError(int net_error) { 16 int32_t NetErrorToPepperError(int net_error) {
14 if (net_error > 0) 17 if (net_error > 0) {
18 CHECK_LE(net_error, std::numeric_limits<int32_t>::max());
bbudge 2013/06/18 14:54:37 Should we crash the browser process? Why not use b
yzshen1 2013/06/18 16:39:16 I think it should be fine, because having a positi
15 return static_cast<int32_t>(net_error); 19 return static_cast<int32_t>(net_error);
20 }
16 21
17 switch (net_error) { 22 switch (net_error) {
18 case net::OK: 23 case net::OK:
19 return PP_OK; 24 return PP_OK;
20 case net::ERR_IO_PENDING: 25 case net::ERR_IO_PENDING:
21 return PP_OK_COMPLETIONPENDING; 26 return PP_OK_COMPLETIONPENDING;
22 case net::ERR_ABORTED: 27 case net::ERR_ABORTED:
23 return PP_ERROR_ABORTED; 28 return PP_ERROR_ABORTED;
24 case net::ERR_INVALID_ARGUMENT: 29 case net::ERR_INVALID_ARGUMENT:
25 return PP_ERROR_BADARGUMENT; 30 return PP_ERROR_BADARGUMENT;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return PP_ERROR_MESSAGE_TOO_BIG; 70 return PP_ERROR_MESSAGE_TOO_BIG;
66 case net::ERR_ADDRESS_IN_USE: 71 case net::ERR_ADDRESS_IN_USE:
67 return PP_ERROR_ADDRESS_IN_USE; 72 return PP_ERROR_ADDRESS_IN_USE;
68 default: 73 default:
69 return PP_ERROR_FAILED; 74 return PP_ERROR_FAILED;
70 } 75 }
71 } 76 }
72 77
73 } // namespace host 78 } // namespace host
74 } // namespace ppapi 79 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698