| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "nacl_io/kernel_intercept.h" | 5 #include "nacl_io/kernel_intercept.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "nacl_io/kernel_proxy.h" | 10 #include "nacl_io/kernel_proxy.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 static KernelProxy* s_kp; | 26 static KernelProxy* s_kp; |
| 27 static bool s_kp_owned; | 27 static bool s_kp_owned; |
| 28 | 28 |
| 29 void ki_init(void* kp) { | 29 void ki_init(void* kp) { |
| 30 ki_init_ppapi(kp, 0, NULL); | 30 ki_init_ppapi(kp, 0, NULL); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ki_init_ppapi(void* kp, | 33 void ki_init_ppapi(void* kp, |
| 34 PP_Instance instance, | 34 PP_Instance instance, |
| 35 PPB_GetInterface get_browser_interface) { | 35 PPB_GetInterface get_browser_interface) { |
| 36 PepperInterface* ppapi = NULL; |
| 37 if (instance && get_browser_interface) |
| 38 ppapi = new RealPepperInterface(instance, get_browser_interface); |
| 39 ki_init_interface(kp, ppapi); |
| 40 } |
| 41 |
| 42 void ki_init_interface(void* kp, void* pepper_interface) { |
| 43 PepperInterface* ppapi = static_cast<PepperInterface*>(pepper_interface); |
| 36 kernel_wrap_init(); | 44 kernel_wrap_init(); |
| 37 | 45 |
| 38 if (kp == NULL) { | 46 if (kp == NULL) { |
| 39 s_kp = new KernelProxy(); | 47 s_kp = new KernelProxy(); |
| 40 s_kp_owned = true; | 48 s_kp_owned = true; |
| 41 } else { | 49 } else { |
| 42 s_kp = static_cast<KernelProxy*>(kp); | 50 s_kp = static_cast<KernelProxy*>(kp); |
| 43 s_kp_owned = false; | 51 s_kp_owned = false; |
| 44 } | 52 } |
| 45 | 53 |
| 46 PepperInterface* ppapi = NULL; | |
| 47 if (instance && get_browser_interface) | |
| 48 ppapi = new RealPepperInterface(instance, get_browser_interface); | |
| 49 | |
| 50 s_kp->Init(ppapi); | 54 s_kp->Init(ppapi); |
| 51 } | 55 } |
| 52 | 56 |
| 53 int ki_register_fs_type(const char* fs_type, struct fuse_operations* fuse_ops) { | 57 int ki_register_fs_type(const char* fs_type, struct fuse_operations* fuse_ops) { |
| 54 return s_kp->RegisterFsType(fs_type, fuse_ops); | 58 return s_kp->RegisterFsType(fs_type, fuse_ops); |
| 55 } | 59 } |
| 56 | 60 |
| 57 int ki_unregister_fs_type(const char* fs_type) { | 61 int ki_unregister_fs_type(const char* fs_type) { |
| 58 return s_kp->UnregisterFsType(fs_type); | 62 return s_kp->UnregisterFsType(fs_type); |
| 59 } | 63 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 int ki_socket(int domain, int type, int protocol) { | 466 int ki_socket(int domain, int type, int protocol) { |
| 463 ON_NOSYS_RETURN(-1); | 467 ON_NOSYS_RETURN(-1); |
| 464 return s_kp->socket(domain, type, protocol); | 468 return s_kp->socket(domain, type, protocol); |
| 465 } | 469 } |
| 466 | 470 |
| 467 int ki_socketpair(int domain, int type, int protocol, int* sv) { | 471 int ki_socketpair(int domain, int type, int protocol, int* sv) { |
| 468 ON_NOSYS_RETURN(-1); | 472 ON_NOSYS_RETURN(-1); |
| 469 return s_kp->socketpair(domain, type, protocol, sv); | 473 return s_kp->socketpair(domain, type, protocol, sv); |
| 470 } | 474 } |
| 471 #endif // PROVIDES_SOCKET_API | 475 #endif // PROVIDES_SOCKET_API |
| OLD | NEW |