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

Side by Side Diff: src/shared/ppapi_proxy/browser_graphics_2d.cc

Issue 5974006: Convert srpc definitions from using int64 to using PP_Instance, PP_Module, an... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 12 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
« no previous file with comments | « src/shared/ppapi_proxy/browser_core.cc ('k') | src/shared/ppapi_proxy/browser_image_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Native Client Authors. All rights reserved. 1 // Copyright (c) 2010 The Native Client 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 "native_client/src/include/portability.h" 5 #include "native_client/src/include/portability.h"
6 #include "native_client/src/include/nacl_macros.h" 6 #include "native_client/src/include/nacl_macros.h"
7 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" 7 #include "native_client/src/shared/ppapi_proxy/browser_globals.h"
8 #include "native_client/src/shared/ppapi_proxy/utility.h" 8 #include "native_client/src/shared/ppapi_proxy/utility.h"
9 #include "ppapi/c/ppb_graphics_2d.h" 9 #include "ppapi/c/ppb_graphics_2d.h"
10 #include "ppapi/c/pp_point.h" 10 #include "ppapi/c/pp_point.h"
11 #include "ppapi/c/pp_rect.h" 11 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/pp_size.h" 12 #include "ppapi/c/pp_size.h"
13 #include "srpcgen/ppb_rpc.h" 13 #include "srpcgen/ppb_rpc.h"
14 14
15 // 15 //
16 // The following methods are the SRPC dispatchers for ppapi/c/ppb_graphics_2d.h. 16 // The following methods are the SRPC dispatchers for ppapi/c/ppb_graphics_2d.h.
17 // 17 //
18 18
19 void PpbGraphics2DRpcServer::PPB_Graphics2D_Create(NaClSrpcRpc* rpc, 19 void PpbGraphics2DRpcServer::PPB_Graphics2D_Create(NaClSrpcRpc* rpc,
20 NaClSrpcClosure* done, 20 NaClSrpcClosure* done,
21 int64_t module, 21 PP_Module module,
22 nacl_abi_size_t size_bytes, 22 nacl_abi_size_t size_bytes,
23 int32_t* size, 23 int32_t* size,
24 int32_t is_always_opaque, 24 int32_t is_always_opaque,
25 int64_t* resource) { 25 PP_Resource* resource) {
26 NaClSrpcClosureRunner runner(done); 26 NaClSrpcClosureRunner runner(done);
27 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 27 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
28 *resource = ppapi_proxy::kInvalidResourceId; 28 *resource = ppapi_proxy::kInvalidResourceId;
29 if (size_bytes != sizeof(struct PP_Size)) { 29 if (size_bytes != sizeof(struct PP_Size)) {
30 return; 30 return;
31 } 31 }
32 PP_Resource pp_resource = ppapi_proxy::PPBGraphics2DInterface()->Create( 32 *resource = ppapi_proxy::PPBGraphics2DInterface()->Create(
33 static_cast<PP_Module>(module), 33 module,
34 const_cast<const struct PP_Size*>( 34 const_cast<const struct PP_Size*>(
35 reinterpret_cast<struct PP_Size*>(size)), 35 reinterpret_cast<struct PP_Size*>(size)),
36 (is_always_opaque ? PP_TRUE : PP_FALSE)); 36 (is_always_opaque ? PP_TRUE : PP_FALSE));
37 *resource = static_cast<int64_t>(pp_resource);
38 rpc->result = NACL_SRPC_RESULT_OK; 37 rpc->result = NACL_SRPC_RESULT_OK;
39 } 38 }
40 39
41 void PpbGraphics2DRpcServer::PPB_Graphics2D_IsGraphics2D(NaClSrpcRpc* rpc, 40 void PpbGraphics2DRpcServer::PPB_Graphics2D_IsGraphics2D(NaClSrpcRpc* rpc,
42 NaClSrpcClosure* done, 41 NaClSrpcClosure* done,
43 int64_t resource, 42 PP_Resource resource,
44 int32_t* success) { 43 int32_t* success) {
45 NaClSrpcClosureRunner runner(done); 44 NaClSrpcClosureRunner runner(done);
46 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 45 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
47 *success = 0; 46 *success = 0;
48 PP_Bool pp_success = 47 PP_Bool pp_success =
49 ppapi_proxy::PPBGraphics2DInterface()->IsGraphics2D( 48 ppapi_proxy::PPBGraphics2DInterface()->IsGraphics2D(resource);
50 static_cast<PP_Resource>(resource));
51 *success = (pp_success == PP_TRUE); 49 *success = (pp_success == PP_TRUE);
52 rpc->result = NACL_SRPC_RESULT_OK; 50 rpc->result = NACL_SRPC_RESULT_OK;
53 } 51 }
54 52
55 void PpbGraphics2DRpcServer::PPB_Graphics2D_Describe( 53 void PpbGraphics2DRpcServer::PPB_Graphics2D_Describe(
56 NaClSrpcRpc* rpc, 54 NaClSrpcRpc* rpc,
57 NaClSrpcClosure* done, 55 NaClSrpcClosure* done,
58 int64_t graphics_2d, 56 PP_Resource graphics_2d,
59 nacl_abi_size_t* size_bytes, 57 nacl_abi_size_t* size_bytes,
60 int32_t* size, 58 int32_t* size,
61 int32_t* is_always_opaque, 59 int32_t* is_always_opaque,
62 int32_t* success) { 60 int32_t* success) {
63 NaClSrpcClosureRunner runner(done); 61 NaClSrpcClosureRunner runner(done);
64 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 62 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
65 *success = 0; 63 *success = 0;
66 if (*size_bytes != sizeof(struct PP_Size)) { 64 if (*size_bytes != sizeof(struct PP_Size)) {
67 return; 65 return;
68 } 66 }
69 PP_Bool is_opaque; 67 PP_Bool is_opaque;
70 PP_Bool pp_success = ppapi_proxy::PPBGraphics2DInterface()->Describe( 68 PP_Bool pp_success = ppapi_proxy::PPBGraphics2DInterface()->Describe(
71 static_cast<PP_Resource>(graphics_2d), 69 graphics_2d, reinterpret_cast<struct PP_Size*>(size), &is_opaque);
72 reinterpret_cast<struct PP_Size*>(size),
73 &is_opaque);
74 *is_always_opaque = (is_opaque == PP_TRUE); 70 *is_always_opaque = (is_opaque == PP_TRUE);
75 *success = (pp_success == PP_TRUE); 71 *success = (pp_success == PP_TRUE);
76 rpc->result = NACL_SRPC_RESULT_OK; 72 rpc->result = NACL_SRPC_RESULT_OK;
77 } 73 }
78 74
79 void PpbGraphics2DRpcServer::PPB_Graphics2D_PaintImageData( 75 void PpbGraphics2DRpcServer::PPB_Graphics2D_PaintImageData(
80 NaClSrpcRpc* rpc, 76 NaClSrpcRpc* rpc,
81 NaClSrpcClosure* done, 77 NaClSrpcClosure* done,
82 int64_t graphics_2d, 78 PP_Resource graphics_2d,
83 int64_t image, 79 PP_Resource image,
84 nacl_abi_size_t top_left_bytes, 80 nacl_abi_size_t top_left_bytes,
85 int32_t* top_left, 81 int32_t* top_left,
86 nacl_abi_size_t src_rect_bytes, 82 nacl_abi_size_t src_rect_bytes,
87 int32_t* src_rect) { 83 int32_t* src_rect) {
88 NaClSrpcClosureRunner runner(done); 84 NaClSrpcClosureRunner runner(done);
89 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 85 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
90 if (top_left_bytes != sizeof(struct PP_Point) || 86 if (top_left_bytes != sizeof(struct PP_Point) ||
91 src_rect_bytes != sizeof(struct PP_Rect)) { 87 src_rect_bytes != sizeof(struct PP_Rect)) {
92 return; 88 return;
93 } 89 }
94 ppapi_proxy::PPBGraphics2DInterface()->PaintImageData( 90 ppapi_proxy::PPBGraphics2DInterface()->PaintImageData(
95 static_cast<PP_Resource>(graphics_2d), 91 graphics_2d,
96 static_cast<PP_Resource>(image), 92 image,
97 const_cast<const struct PP_Point*>( 93 const_cast<const struct PP_Point*>(
98 reinterpret_cast<struct PP_Point*>(top_left)), 94 reinterpret_cast<struct PP_Point*>(top_left)),
99 const_cast<const struct PP_Rect*>( 95 const_cast<const struct PP_Rect*>(
100 reinterpret_cast<struct PP_Rect*>(src_rect))); 96 reinterpret_cast<struct PP_Rect*>(src_rect)));
101 rpc->result = NACL_SRPC_RESULT_OK; 97 rpc->result = NACL_SRPC_RESULT_OK;
102 } 98 }
103 99
104 void PpbGraphics2DRpcServer::PPB_Graphics2D_Scroll( 100 void PpbGraphics2DRpcServer::PPB_Graphics2D_Scroll(
105 NaClSrpcRpc* rpc, 101 NaClSrpcRpc* rpc,
106 NaClSrpcClosure* done, 102 NaClSrpcClosure* done,
107 int64_t graphics_2d, 103 PP_Resource graphics_2d,
108 nacl_abi_size_t clip_rect_bytes, 104 nacl_abi_size_t clip_rect_bytes,
109 int32_t* clip_rect, 105 int32_t* clip_rect,
110 nacl_abi_size_t amount_bytes, 106 nacl_abi_size_t amount_bytes,
111 int32_t* amount) { 107 int32_t* amount) {
112 NaClSrpcClosureRunner runner(done); 108 NaClSrpcClosureRunner runner(done);
113 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 109 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
114 if (clip_rect_bytes != sizeof(struct PP_Rect) || 110 if (clip_rect_bytes != sizeof(struct PP_Rect) ||
115 amount_bytes != sizeof(struct PP_Point)) { 111 amount_bytes != sizeof(struct PP_Point)) {
116 return; 112 return;
117 } 113 }
118 ppapi_proxy::PPBGraphics2DInterface()->Scroll( 114 ppapi_proxy::PPBGraphics2DInterface()->Scroll(
119 static_cast<PP_Resource>(graphics_2d), 115 graphics_2d,
120 const_cast<const struct PP_Rect*>( 116 const_cast<const struct PP_Rect*>(
121 reinterpret_cast<struct PP_Rect*>(clip_rect)), 117 reinterpret_cast<struct PP_Rect*>(clip_rect)),
122 const_cast<const struct PP_Point*>( 118 const_cast<const struct PP_Point*>(
123 reinterpret_cast<struct PP_Point*>(amount))); 119 reinterpret_cast<struct PP_Point*>(amount)));
124 rpc->result = NACL_SRPC_RESULT_OK; 120 rpc->result = NACL_SRPC_RESULT_OK;
125 } 121 }
126 122
127 void PpbGraphics2DRpcServer::PPB_Graphics2D_ReplaceContents( 123 void PpbGraphics2DRpcServer::PPB_Graphics2D_ReplaceContents(
128 NaClSrpcRpc* rpc, 124 NaClSrpcRpc* rpc,
129 NaClSrpcClosure* done, 125 NaClSrpcClosure* done,
130 int64_t graphics_2d, 126 PP_Resource graphics_2d,
131 int64_t image) { 127 PP_Resource image) {
132 NaClSrpcClosureRunner runner(done); 128 NaClSrpcClosureRunner runner(done);
133 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 129 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
134 ppapi_proxy::PPBGraphics2DInterface()->ReplaceContents( 130 ppapi_proxy::PPBGraphics2DInterface()->ReplaceContents(graphics_2d, image);
135 static_cast<PP_Resource>(graphics_2d),
136 static_cast<PP_Resource>(image));
137 rpc->result = NACL_SRPC_RESULT_OK; 131 rpc->result = NACL_SRPC_RESULT_OK;
138 } 132 }
139 133
140 // Flush is handled on the upcall thread, where another RPC service 134 // Flush is handled on the upcall thread, where another RPC service
141 // (PppUpcallRpcServer) is exported. 135 // (PppUpcallRpcServer) is exported.
OLDNEW
« no previous file with comments | « src/shared/ppapi_proxy/browser_core.cc ('k') | src/shared/ppapi_proxy/browser_image_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698