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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc

Issue 148223005: [NaCl SDK] Add fake for ppb_host_resolver and ppb_net_address (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698