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

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

Issue 418423002: Pepper: Stop using SRPC for irt_open_resource(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for dmichael Created 6 years, 4 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"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 void ManifestService::StartupInitializationComplete() { 78 void ManifestService::StartupInitializationComplete() {
79 filter_->Send(new PpapiHostMsg_StartupInitializationComplete); 79 filter_->Send(new PpapiHostMsg_StartupInitializationComplete);
80 } 80 }
81 81
82 bool ManifestService::OpenResource(const char* file, int* fd) { 82 bool ManifestService::OpenResource(const char* file, int* fd) {
83 // OpenResource will return INVALID SerializedHandle, if it is not supported. 83 // OpenResource will return INVALID SerializedHandle, if it is not supported.
84 // Specifically, PNaCl doesn't support open resource. 84 // Specifically, PNaCl doesn't support open resource.
85 ppapi::proxy::SerializedHandle ipc_fd; 85 ppapi::proxy::SerializedHandle ipc_fd;
86 if (!filter_->Send(new PpapiHostMsg_OpenResource( 86 if (!filter_->Send(new PpapiHostMsg_OpenResource(
87 std::string(kFilePrefix) + file, &ipc_fd)) || 87 std::string(kFilePrefix) + file, &ipc_fd))) {
88 !ipc_fd.is_file()) {
Mark Seaborn 2014/08/07 04:46:23 Is this change required to fix something? Maybe c
teravest 2014/08/07 18:47:02 Removing this condition is required as part of thi
89 LOG(ERROR) << "ManifestService::OpenResource failed:" << file; 88 LOG(ERROR) << "ManifestService::OpenResource failed:" << file;
90 *fd = -1; 89 *fd = -1;
91 return false; 90 return false;
92 } 91 }
93 92
94 *fd = ipc_fd.descriptor().fd; 93 if (ipc_fd.is_file())
94 *fd = ipc_fd.descriptor().fd;
Mark Seaborn 2014/08/07 04:46:23 Nit: I think multi-line ifs are meant to use {}s
teravest 2014/08/07 18:47:02 The rule is that the if and else clauses must agre
95 else
96 *fd = -1;
95 return true; 97 return true;
96 } 98 }
97 99
98 int IrtOpenResource(const char* file, int* fd) { 100 int IrtOpenResource(const char* file, int* fd) {
99 // Remove leading '/' character. 101 // Remove leading '/' character.
100 if (file[0] == '/') 102 if (file[0] == '/')
101 ++file; 103 ++file;
102 104
103 ManifestService* manifest_service = GetManifestService(); 105 ManifestService* manifest_service = GetManifestService();
104 if (manifest_service == NULL || 106 if (manifest_service == NULL ||
105 !manifest_service->OpenResource(file, fd)) { 107 !manifest_service->OpenResource(file, fd)) {
106 return NACL_ABI_EIO; 108 return NACL_ABI_EIO;
107 } 109 }
108
109 return (*fd == -1) ? NACL_ABI_ENOENT : 0; 110 return (*fd == -1) ? NACL_ABI_ENOENT : 0;
110 } 111 }
111 112
112 } // namespace ppapi 113 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698