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

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

Issue 1070233007: Stop adding the "files/" prefix when sending open_resource IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 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
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 "native_client/src/trusted/service_runtime/include/sys/errno.h" 11 #include "native_client/src/trusted/service_runtime/include/sys/errno.h"
12 #include "ppapi/nacl_irt/irt_manifest.h" 12 #include "ppapi/nacl_irt/irt_manifest.h"
13 #include "ppapi/nacl_irt/plugin_startup.h" 13 #include "ppapi/nacl_irt/plugin_startup.h"
14 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
15 15
16 #if !defined(OS_NACL_SFI) 16 #if !defined(OS_NACL_SFI)
17 #include <pthread.h> 17 #include <pthread.h>
18 #include <map> 18 #include <map>
19 #include <string> 19 #include <string>
20 #endif 20 #endif
21 21
22 namespace ppapi { 22 namespace ppapi {
23 23
24 const char kFilePrefix[] = "files/";
25
26 // IPC channel is asynchronously set up. So, the NaCl process may try to 24 // IPC channel is asynchronously set up. So, the NaCl process may try to
27 // send a OpenResource message to the host before the connection is 25 // send a OpenResource message to the host before the connection is
28 // established. In such a case, it is necessary to wait for the set up 26 // established. In such a case, it is necessary to wait for the set up
29 // completion. 27 // completion.
30 class ManifestMessageFilter : public IPC::SyncMessageFilter { 28 class ManifestMessageFilter : public IPC::SyncMessageFilter {
31 public: 29 public:
32 ManifestMessageFilter(base::WaitableEvent* shutdown_event) 30 ManifestMessageFilter(base::WaitableEvent* shutdown_event)
33 : SyncMessageFilter(shutdown_event), 31 : SyncMessageFilter(shutdown_event),
34 connected_event_( 32 connected_event_(
35 true /* manual_reset */, false /* initially_signaled */) { 33 true /* manual_reset */, false /* initially_signaled */) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 92
95 // OpenResource will return INVALID SerializedHandle, if it is not supported. 93 // OpenResource will return INVALID SerializedHandle, if it is not supported.
96 // Specifically, PNaCl doesn't support open resource. 94 // Specifically, PNaCl doesn't support open resource.
97 ppapi::proxy::SerializedHandle ipc_fd; 95 ppapi::proxy::SerializedHandle ipc_fd;
98 96
99 // File tokens are ignored here, but needed when the message is processed 97 // File tokens are ignored here, but needed when the message is processed
100 // inside NaClIPCAdapter. 98 // inside NaClIPCAdapter.
101 uint64_t file_token_lo = 0; 99 uint64_t file_token_lo = 0;
102 uint64_t file_token_hi = 0; 100 uint64_t file_token_hi = 0;
103 if (!filter_->Send(new PpapiHostMsg_OpenResource( 101 if (!filter_->Send(new PpapiHostMsg_OpenResource(
104 std::string(kFilePrefix) + file, 102 file,
105 &ipc_fd, 103 &ipc_fd,
106 &file_token_lo, 104 &file_token_lo,
107 &file_token_hi))) { 105 &file_token_hi))) {
108 LOG(ERROR) << "ManifestService::OpenResource failed:" << file; 106 LOG(ERROR) << "ManifestService::OpenResource failed:" << file;
109 *fd = -1; 107 *fd = -1;
110 return false; 108 return false;
111 } 109 }
112 110
113 // File tokens are used internally by NaClIPCAdapter and should have 111 // File tokens are used internally by NaClIPCAdapter and should have
114 // been cleared from the message when it is received here. 112 // been cleared from the message when it is received here.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 163
166 ManifestService* manifest_service = GetManifestService(); 164 ManifestService* manifest_service = GetManifestService();
167 if (manifest_service == NULL || 165 if (manifest_service == NULL ||
168 !manifest_service->OpenResource(file, fd)) { 166 !manifest_service->OpenResource(file, fd)) {
169 return NACL_ABI_EIO; 167 return NACL_ABI_EIO;
170 } 168 }
171 return (*fd == -1) ? NACL_ABI_ENOENT : 0; 169 return (*fd == -1) ? NACL_ABI_ENOENT : 0;
172 } 170 }
173 171
174 } // namespace ppapi 172 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698