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

Side by Side Diff: native_client_sdk/src/libraries/nacl_mounts/pepper_interface.cc

Issue 12194030: Rename mount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix whitespace Created 7 years, 10 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
(Empty)
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5 #include "nacl_mounts/pepper_interface.h"
6 #include <errno.h>
7 #include <ppapi/c/pp_errors.h>
8
9 ScopedResource::ScopedResource(PepperInterface* ppapi, PP_Resource resource)
10 : ppapi_(ppapi),
11 resource_(resource) {
12 }
13
14 ScopedResource::~ScopedResource() {
15 if (resource_)
16 ppapi_->ReleaseResource(resource_);
17 }
18
19 PP_Resource ScopedResource::Release() {
20 PP_Resource result = resource_;
21 resource_ = 0;
22 return result;
23 }
24
25 int PPErrorToErrno(int32_t err) {
26 switch (err) {
27 case PP_OK: return 0;
28 case PP_OK_COMPLETIONPENDING: return 0;
29 case PP_ERROR_FAILED: return EPERM;
30 case PP_ERROR_ABORTED: return EPERM;
31 case PP_ERROR_BADARGUMENT: return EINVAL;
32 case PP_ERROR_BADRESOURCE: return EBADF;
33 case PP_ERROR_NOINTERFACE: return ENOSYS;
34 case PP_ERROR_NOACCESS: return EACCES;
35 case PP_ERROR_NOMEMORY: return ENOMEM;
36 case PP_ERROR_NOSPACE: return ENOSPC;
37 case PP_ERROR_NOQUOTA: return ENOSPC;
38 case PP_ERROR_INPROGRESS: return EBUSY;
39 case PP_ERROR_NOTSUPPORTED: return ENOSYS;
40 case PP_ERROR_BLOCKS_MAIN_THREAD: return EPERM;
41 case PP_ERROR_FILENOTFOUND: return ENOENT;
42 case PP_ERROR_FILEEXISTS: return EEXIST;
43 case PP_ERROR_FILETOOBIG: return EFBIG;
44 case PP_ERROR_FILECHANGED: return EINVAL;
45 case PP_ERROR_TIMEDOUT: return EBUSY;
46 case PP_ERROR_USERCANCEL: return EPERM;
47 case PP_ERROR_NO_USER_GESTURE: return EPERM;
48 case PP_ERROR_CONTEXT_LOST: return EPERM;
49 case PP_ERROR_NO_MESSAGE_LOOP: return EPERM;
50 case PP_ERROR_WRONG_THREAD: return EPERM;
51 }
52
53 return EINVAL;
54 }
55
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698