Correctly reset theme color on NTP.
[chromium-blink-merge.git] / ppapi / nacl_irt / irt_pnacl_translator_link.cc
blobf5569aa54acb25d180a14432fd9f922c4b2c3c57
1 // Copyright 2015 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.
5 #include "native_client/src/shared/platform/nacl_log.h"
6 #include "native_client/src/shared/srpc/nacl_srpc.h"
7 #include "native_client/src/untrusted/irt/irt_dev.h"
8 #include "ppapi/nacl_irt/irt_interfaces.h"
10 namespace {
12 const int kMaxObjectFiles = 16;
14 int (*g_func)(int nexe_fd,
15 const int* obj_file_fds,
16 int obj_file_fd_count);
18 void HandleLinkRequest(NaClSrpcRpc* rpc,
19 NaClSrpcArg** in_args,
20 NaClSrpcArg** out_args,
21 NaClSrpcClosure* done) {
22 int obj_file_count = in_args[0]->u.ival;
23 int nexe_fd = in_args[kMaxObjectFiles + 1]->u.hval;
25 if (obj_file_count < 1 || obj_file_count > kMaxObjectFiles) {
26 NaClLog(LOG_FATAL, "Bad object file count (%i)\n", obj_file_count);
28 int obj_file_fds[obj_file_count];
29 for (int i = 0; i < obj_file_count; i++) {
30 obj_file_fds[i] = in_args[i + 1]->u.hval;
33 int result = g_func(nexe_fd, obj_file_fds, obj_file_count);
35 rpc->result = result == 0 ? NACL_SRPC_RESULT_OK : NACL_SRPC_RESULT_APP_ERROR;
36 done->Run(done);
39 const struct NaClSrpcHandlerDesc kSrpcMethods[] = {
40 { "RunWithSplit:ihhhhhhhhhhhhhhhhh:", HandleLinkRequest },
41 { NULL, NULL },
44 void ServeLinkRequest(int (*func)(int nexe_fd,
45 const int* obj_file_fds,
46 int obj_file_fd_count)) {
47 g_func = func;
48 if (!NaClSrpcModuleInit()) {
49 NaClLog(LOG_FATAL, "NaClSrpcModuleInit() failed\n");
51 if (!NaClSrpcAcceptClientConnection(kSrpcMethods)) {
52 NaClLog(LOG_FATAL, "NaClSrpcAcceptClientConnection() failed\n");
58 const struct nacl_irt_private_pnacl_translator_link
59 nacl_irt_private_pnacl_translator_link = {
60 ServeLinkRequest