| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "content/common/sandbox_linux/sandbox_linux.h" | 13 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/common/sandbox_init.h" | 15 #include "content/public/common/sandbox_init.h" |
| 16 | 16 |
| 17 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
| 18 #include "v8/src/third_party/vtune/v8-vtune.h" | |
| 19 #endif | |
| 20 | |
| 21 namespace content { | 17 namespace content { |
| 22 | 18 |
| 23 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 19 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 24 const MainFunctionParams& parameters) | 20 const MainFunctionParams& parameters) |
| 25 : parameters_(parameters) { | 21 : parameters_(parameters) { |
| 26 } | 22 } |
| 27 | 23 |
| 28 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 24 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 29 } | 25 } |
| 30 | 26 |
| 31 void RendererMainPlatformDelegate::PlatformInitialize() { | 27 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 32 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
| 33 const CommandLine& command_line = parameters_.command_line; | |
| 34 if (command_line.HasSwitch(switches::kEnableVtune)) | |
| 35 vTune::InitializeVtuneForV8(); | |
| 36 #endif | |
| 37 } | 28 } |
| 38 | 29 |
| 39 void RendererMainPlatformDelegate::PlatformUninitialize() { | 30 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 40 } | 31 } |
| 41 | 32 |
| 42 bool RendererMainPlatformDelegate::EnableSandbox() { | 33 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 43 // The setuid sandbox is started in the zygote process: zygote_main_linux.cc | 34 // The setuid sandbox is started in the zygote process: zygote_main_linux.cc |
| 44 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox | 35 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox |
| 45 // | 36 // |
| 46 // Anything else is started in InitializeSandbox(). | 37 // Anything else is started in InitializeSandbox(). |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 // but we know that under the seccomp-bpf sandbox, this should return EPERM. | 59 // but we know that under the seccomp-bpf sandbox, this should return EPERM. |
| 69 CHECK_EQ(fchmod(-1, 07777), -1); | 60 CHECK_EQ(fchmod(-1, 07777), -1); |
| 70 CHECK_EQ(errno, EPERM); | 61 CHECK_EQ(errno, EPERM); |
| 71 } | 62 } |
| 72 #endif // __x86_64__ | 63 #endif // __x86_64__ |
| 73 | 64 |
| 74 return true; | 65 return true; |
| 75 } | 66 } |
| 76 | 67 |
| 77 } // namespace content | 68 } // namespace content |
| OLD | NEW |