| OLD | NEW |
| 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 "components/nacl/loader/nonsfi/nonsfi_main.h" | 5 #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 typedef void (*EntryPointType)(uintptr_t*); | 23 typedef void (*EntryPointType)(uintptr_t*); |
| 24 | 24 |
| 25 class PluginMainDelegate : public base::PlatformThread::Delegate { | 25 class PluginMainDelegate : public base::PlatformThread::Delegate { |
| 26 public: | 26 public: |
| 27 explicit PluginMainDelegate(EntryPointType entry_point) | 27 explicit PluginMainDelegate(EntryPointType entry_point) |
| 28 : entry_point_(entry_point) { | 28 : entry_point_(entry_point) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual ~PluginMainDelegate() { | 31 ~PluginMainDelegate() override {} |
| 32 } | |
| 33 | 32 |
| 34 virtual void ThreadMain() override { | 33 void ThreadMain() override { |
| 35 base::PlatformThread::SetName("NaClMainThread"); | 34 base::PlatformThread::SetName("NaClMainThread"); |
| 36 | 35 |
| 37 // This will only happen once per process, so we give the permission to | 36 // This will only happen once per process, so we give the permission to |
| 38 // create Singletons. | 37 // create Singletons. |
| 39 base::ThreadRestrictions::SetSingletonAllowed(true); | 38 base::ThreadRestrictions::SetSingletonAllowed(true); |
| 40 uintptr_t info[] = { | 39 uintptr_t info[] = { |
| 41 0, // Do not use fini. | 40 0, // Do not use fini. |
| 42 0, // envc. | 41 0, // envc. |
| 43 0, // argc. | 42 0, // argc. |
| 44 0, // Null terminate for argv. | 43 0, // Null terminate for argv. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 reinterpret_cast<EntryPointType>(image.entry_point()); | 83 reinterpret_cast<EntryPointType>(image.entry_point()); |
| 85 if (!base::PlatformThread::CreateNonJoinable( | 84 if (!base::PlatformThread::CreateNonJoinable( |
| 86 kStackSize, new PluginMainDelegate(entry_point))) { | 85 kStackSize, new PluginMainDelegate(entry_point))) { |
| 87 LOG(ERROR) << "LoadModuleRpc: Failed to create plugin main thread."; | 86 LOG(ERROR) << "LoadModuleRpc: Failed to create plugin main thread."; |
| 88 return; | 87 return; |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace nonsfi | 91 } // namespace nonsfi |
| 93 } // namespace nacl | 92 } // namespace nacl |
| OLD | NEW |