| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 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 <pthread.h> | 5 #include <pthread.h> |
| 6 #include <unistd.h> | 6 #include <unistd.h> |
| 7 | 7 |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "native_client/src/untrusted/irt/irt.h" | 11 #include "native_client/src/untrusted/irt/irt.h" |
| 12 | 12 |
| 13 #include "ppapi/cpp/completion_callback.h" | 13 #include "ppapi/cpp/completion_callback.h" |
| 14 #include "ppapi/cpp/instance.h" | 14 #include "ppapi/cpp/instance.h" |
| 15 #include "ppapi/cpp/module.h" | 15 #include "ppapi/cpp/module.h" |
| 16 #include "ppapi/cpp/tcp_socket.h" | 16 #include "ppapi/cpp/tcp_socket.h" |
| 17 #include "ppapi/cpp/var.h" | 17 #include "ppapi/cpp/var.h" |
| 18 #include "ppapi/utility/completion_callback_factory.h" | 18 #include "ppapi/utility/completion_callback_factory.h" |
| 19 | 19 |
| 20 #if defined(__clang__) |
| 21 // ipc_message_attachment_set.h depends on C++11 which nacl-g++ does not |
| 22 // fully support. |
| 23 #include "ipc/ipc_message_attachment_set.h" |
| 24 #endif |
| 25 |
| 20 namespace { | 26 namespace { |
| 21 | 27 |
| 22 std::string g_last_error; | 28 std::string g_last_error; |
| 23 pp::Instance* g_instance = NULL; | 29 pp::Instance* g_instance = NULL; |
| 24 | 30 |
| 25 // This should be the same as MessageAttachmentSet::kMaxDescriptorsPerMessage in | 31 // This should be the same as MessageAttachmentSet::kMaxDescriptorsPerMessage in |
| 26 // ipc/ipc_message_attachment_set.h. | 32 // ipc/ipc_message_attachment_set.h. |
| 27 // TODO(yusukes): Once all the NaCl toolchains support C++11, Add | |
| 28 // #include "ipc/file_descriptor_set_posix.h" and remove the constant. | |
| 29 const size_t kMaxDescriptorsPerMessage = 128; | 33 const size_t kMaxDescriptorsPerMessage = 128; |
| 30 | 34 |
| 35 #if defined(__clang__) |
| 36 static_assert(kMaxDescriptorsPerMessage == |
| 37 IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage, |
| 38 "kMaxDescriptorsPerMessage is not up to date"); |
| 39 #endif |
| 40 |
| 31 // Returns true if the resource file whose name is |key| exists and its content | 41 // Returns true if the resource file whose name is |key| exists and its content |
| 32 // matches |content|. | 42 // matches |content|. |
| 33 bool LoadManifestInternal(nacl_irt_resource_open* nacl_irt_resource_open, | 43 bool LoadManifestInternal(nacl_irt_resource_open* nacl_irt_resource_open, |
| 34 const std::string& key, | 44 const std::string& key, |
| 35 const std::string& content) { | 45 const std::string& content) { |
| 36 int desc; | 46 int desc; |
| 37 int error; | 47 int error; |
| 38 error = nacl_irt_resource_open->open_resource(key.c_str(), &desc); | 48 error = nacl_irt_resource_open->open_resource(key.c_str(), &desc); |
| 39 if (0 != error) { | 49 if (0 != error) { |
| 40 g_last_error = "Can't open file " + key; | 50 g_last_error = "Can't open file " + key; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 169 |
| 160 } // namespace | 170 } // namespace |
| 161 | 171 |
| 162 namespace pp { | 172 namespace pp { |
| 163 | 173 |
| 164 Module* CreateModule() { | 174 Module* CreateModule() { |
| 165 return new MyModule(); | 175 return new MyModule(); |
| 166 } | 176 } |
| 167 | 177 |
| 168 } // namespace pp | 178 } // namespace pp |
| OLD | NEW |