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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 2011 The Native Client 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 "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h"
6
7 #include "native_client/src/include/nacl_scoped_ptr.h"
8 #include "native_client/src/include/portability.h"
9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h"
10 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
11 #include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
12 #include "native_client/src/shared/ppapi_proxy/utility.h"
13 #include "ppapi/c/dev/ppb_testing_dev.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_errors.h"
16 #include "ppapi/c/pp_point.h"
17 #include "ppapi/c/pp_rect.h"
18 #include "srpcgen/ppb_rpc.h"
19
20 namespace ppapi_proxy {
21
22 namespace {
23
24 const nacl_abi_size_t kPPPointBytes =
25 static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
26
27 PP_Bool ReadImageData(PP_Resource device_context_2d,
28 PP_Resource image,
29 const struct PP_Point* top_left) {
30 DebugPrintf("PPB_Testing::ReadImageData: device_context_2d=%"NACL_PRIu32"\n",
31 device_context_2d);
32
33 int32_t success = 0;
34 NaClSrpcError srpc_result =
35 PpbTestingRpcClient::PPB_Testing_ReadImageData(
36 GetMainSrpcChannel(),
37 device_context_2d,
38 image,
39 kPPPointBytes,
40 reinterpret_cast<char*>(const_cast<PP_Point*>(top_left)),
41 &success);
42
43 DebugPrintf("PPB_Testing::ReadImageData: %s\n",
44 NaClSrpcErrorString(srpc_result));
45 if (srpc_result == NACL_SRPC_RESULT_OK && success)
46 return PP_TRUE;
47 return PP_FALSE;
48 }
49
50 void RunMessageLoop(PP_Instance instance) {
51 DebugPrintf("PPB_Testing::RunMessageLoop: instance=%"NACL_PRIu32"\n",
52 instance);
53
54 NaClSrpcError srpc_result =
55 PpbTestingRpcClient::PPB_Testing_RunMessageLoop(
56 GetMainSrpcChannel(),
57 instance);
58
59 DebugPrintf("PPB_Testing::RunMessageLoop: %s\n",
60 NaClSrpcErrorString(srpc_result));
61 }
62
63 void QuitMessageLoop(PP_Instance instance) {
64 DebugPrintf("PPB_Testing::QuitMessageLoop: instance=%"NACL_PRIu32"\n",
65 instance);
66
67 NaClSrpcError srpc_result =
68 PpbTestingRpcClient::PPB_Testing_QuitMessageLoop(
69 GetMainSrpcChannel(),
70 instance);
71
72 DebugPrintf("PPB_Testing::QuitMessageLoop: %s\n",
73 NaClSrpcErrorString(srpc_result));
74 }
75
76 uint32_t GetLiveObjectsForInstance(PP_Instance instance) {
77 DebugPrintf("PPB_Testing::GetLiveObjectsForInstance: "
78 "instance=%"NACL_PRIu32"\n", instance);
79
80 int32_t live_object_count = 0;
81 NaClSrpcError srpc_result =
82 PpbTestingRpcClient::PPB_Testing_GetLiveObjectsForInstance(
83 GetMainSrpcChannel(),
84 instance,
85 &live_object_count);
86
87 DebugPrintf("PPB_Testing::GetLiveObjectsForInstance: %s\n",
88 NaClSrpcErrorString(srpc_result));
89 return live_object_count;
90 }
91
92 } // namespace
93
94 const PPB_Testing_Dev* PluginTesting::GetInterface() {
95 static const PPB_Testing_Dev testing_interface = {
96 ReadImageData,
97 RunMessageLoop,
98 QuitMessageLoop,
99 GetLiveObjectsForInstance
100 };
101 return &testing_interface;
102 }
103
104 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698