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

Side by Side Diff: ppapi/nacl_irt/manifest_service.cc

Issue 249183004: Implement open_resource in non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ppapi/nacl_irt/manifest_service.h" 5 #include "ppapi/nacl_irt/manifest_service.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "ipc/ipc_channel_handle.h" 8 #include "ipc/ipc_channel_handle.h"
9 #include "ipc/ipc_channel_proxy.h" 9 #include "ipc/ipc_channel_proxy.h"
10 #include "ipc/ipc_sync_message_filter.h" 10 #include "ipc/ipc_sync_message_filter.h"
11 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 14
15 const char kFilePrefix[] = "files/";
16
15 ManifestService::ManifestService( 17 ManifestService::ManifestService(
16 const IPC::ChannelHandle& handle, 18 const IPC::ChannelHandle& handle,
17 scoped_refptr<base::MessageLoopProxy> io_message_loop, 19 scoped_refptr<base::MessageLoopProxy> io_message_loop,
18 base::WaitableEvent* shutdown_event) { 20 base::WaitableEvent* shutdown_event) {
19 filter_ = new IPC::SyncMessageFilter(shutdown_event); 21 filter_ = new IPC::SyncMessageFilter(shutdown_event);
20 channel_.reset(new IPC::ChannelProxy(handle, 22 channel_.reset(new IPC::ChannelProxy(handle,
21 IPC::Channel::MODE_SERVER, 23 IPC::Channel::MODE_SERVER,
22 NULL, // Listener 24 NULL, // Listener
23 io_message_loop)); 25 io_message_loop));
24 channel_->AddFilter(filter_.get()); 26 channel_->AddFilter(filter_.get());
25 } 27 }
26 28
27 ManifestService::~ManifestService() { 29 ManifestService::~ManifestService() {
28 } 30 }
29 31
30 void ManifestService::StartupInitializationComplete() { 32 void ManifestService::StartupInitializationComplete() {
31 filter_->Send(new PpapiHostMsg_StartupInitializationComplete); 33 filter_->Send(new PpapiHostMsg_StartupInitializationComplete);
32 } 34 }
33 35
36 bool ManifestService::OpenResource(const char* file, int* fd) {
37 ppapi::proxy::SerializedHandle ipc_fd;
38 if (!filter_->Send(new PpapiHostMsg_OpenResource(
39 std::string(kFilePrefix) + file, &ipc_fd))) {
dmichael (off chromium) 2014/04/25 21:06:58 Why this magical files/ prefix? Shouldn't "file" j
Mark Seaborn 2014/04/26 00:18:59 This is matching existing behaviour, I guess (whic
hidehiko 2014/04/28 08:44:27 Exactly as Mark said, this is just to be compatibl
40 LOG(ERROR) << "ManifestService::OpenResource failed:" << file;
41 *fd = -1;
42 return false;
43 }
44
45 *fd = IPC::PlatformFileForTransitToPlatformFile(ipc_fd.descriptor());
46 return true;
47 }
48
34 } // namespace ppapi 49 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698