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

Side by Side Diff: ppapi/proxy/mojo_resource.cc

Issue 598183002: Pepper: PPB_Mojo prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « ppapi/proxy/mojo_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 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.
4
5 #include "ppapi/proxy/mojo_resource.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/proxy/ppapi_messages.h"
9
10 namespace ppapi {
11 namespace proxy {
12
13 MojoResource::MojoResource(Connection connection, PP_Instance instance)
14 : PluginResource(connection, instance) {
15 SendCreate(BROWSER, PpapiHostMsg_Mojo_Create());
16 }
17
18 MojoResource::~MojoResource() {
19 }
20
21 thunk::PPB_Mojo_API* MojoResource::AsPPB_Mojo_API() {
22 return this;
23 }
24
25 int32_t MojoResource::GetHandle(PP_Instance instance,
26 uint32_t* out_mojo_handle,
27 scoped_refptr<TrackedCallback> callback) {
28 Call<PpapiPluginMsg_Mojo_GetHandleReply>(
29 BROWSER,
30 PpapiHostMsg_Mojo_GetHandle(),
31 base::Bind(&MojoResource::GetHandleComplete,
32 this, out_mojo_handle, callback));
33 return PP_OK_COMPLETIONPENDING;
34 }
35
36 void MojoResource::GetHandleComplete(uint32_t* out_mojo_handle,
37 scoped_refptr<TrackedCallback> callback,
38 const ResourceMessageReplyParams& params) {
39 IPC::PlatformFileForTransit transit_file;
40 if (!params.TakeFileHandleAtIndex(0, &transit_file)) {
41 callback->Run(PP_ERROR_FAILED);
42 return;
43 }
44 *out_mojo_handle = transit_file.fd;
45 callback->Run(PP_OK);
46 }
47
48 } // namespace proxy
49 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/mojo_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698