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

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

Issue 339213003: Pepper: Simplify OpenResource() for Non-SFI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 19 matching lines...) Expand all
30 } 30 }
31 31
32 ManifestService::~ManifestService() { 32 ManifestService::~ManifestService() {
33 } 33 }
34 34
35 void ManifestService::StartupInitializationComplete() { 35 void ManifestService::StartupInitializationComplete() {
36 filter_->Send(new PpapiHostMsg_StartupInitializationComplete); 36 filter_->Send(new PpapiHostMsg_StartupInitializationComplete);
37 } 37 }
38 38
39 bool ManifestService::OpenResource(const char* file, int* fd) { 39 bool ManifestService::OpenResource(const char* file, int* fd) {
40 // OpenResource will return INVALID SerializedHandle, if it is not supported.
41 // Specifically, PNaCl doesn't support open resource.
42 ppapi::proxy::SerializedHandle ipc_fd; 40 ppapi::proxy::SerializedHandle ipc_fd;
43 if (!filter_->Send(new PpapiHostMsg_OpenResource( 41 if (!filter_->Send(new PpapiHostMsg_OpenResource(
44 std::string(kFilePrefix) + file, &ipc_fd)) || 42 std::string(kFilePrefix) + file, &ipc_fd))) {
45 !ipc_fd.is_file()) {
hidehiko 2014/06/18 04:43:11 Why this is removed?
teravest 2014/06/18 20:13:44 That's some carryover from debugging. Restored.
46 LOG(ERROR) << "ManifestService::OpenResource failed:" << file; 43 LOG(ERROR) << "ManifestService::OpenResource failed:" << file;
47 *fd = -1; 44 *fd = -1;
48 return false; 45 return false;
49 } 46 }
50 47
51 *fd = ipc_fd.descriptor().fd; 48 *fd = ipc_fd.descriptor().fd;
52 return true; 49 return true;
53 } 50 }
54 51
55 int IrtOpenResource(const char* file, int* fd) { 52 int IrtOpenResource(const char* file, int* fd) {
56 // Remove leading '/' character. 53 // Remove leading '/' character.
57 if (file[0] == '/') 54 if (file[0] == '/')
58 ++file; 55 ++file;
59 56
60 ManifestService* manifest_service = GetManifestService(); 57 ManifestService* manifest_service = GetManifestService();
61 if (manifest_service == NULL || 58 if (manifest_service == NULL ||
62 !manifest_service->OpenResource(file, fd)) { 59 !manifest_service->OpenResource(file, fd)) {
63 return NACL_ABI_EIO; 60 return NACL_ABI_EIO;
64 } 61 }
65 62
66 return (*fd == -1) ? NACL_ABI_ENOENT : 0; 63 return (*fd == -1) ? NACL_ABI_ENOENT : 0;
67 } 64 }
68 65
69 } // namespace ppapi 66 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698