From de9e0b5949b3a512787ae174137714e0effb7546 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 23 Dec 2010 22:01:17 +0000 Subject: [PATCH] Mac: Unbreak --no-gpu-sandbox. This regressed when I moved CrApplication out of base. BUG=none TEST=none Review URL: http://codereview.chromium.org/6065007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70102 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/chrome_application_mac.h | 13 ++++++++++++- chrome/common/chrome_application_mac.mm | 4 ++++ chrome/common/sandbox_mac.mm | 4 ---- chrome/gpu/gpu_main.cc | 5 +++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/chrome/common/chrome_application_mac.h b/chrome/common/chrome_application_mac.h index 585601d8153f2..2ea557c22bbeb 100644 --- a/chrome/common/chrome_application_mac.h +++ b/chrome/common/chrome_application_mac.h @@ -6,6 +6,8 @@ #define CHROME_COMMON_CHROME_APPLICATION_MAC_H_ #pragma once +#if defined(__OBJC__) + #import <AppKit/AppKit.h> #include "base/basictypes.h" @@ -55,6 +57,15 @@ class ScopedSendingEvent { DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent); }; -} // chrome_application_mac +} // namespace chrome_application_mac + +#endif // defined(__OBJC__) + +namespace chrome_application_mac { + +// To be used to instantiate CrApplication from C++ code. +void RegisterCrApp(); + +} // namespace chrome_application_mac #endif // CHROME_COMMON_CHROME_APPLICATION_MAC_H_ diff --git a/chrome/common/chrome_application_mac.mm b/chrome/common/chrome_application_mac.mm index 9bd9f678ae2a0..3c1b013b14f1c 100644 --- a/chrome/common/chrome_application_mac.mm +++ b/chrome/common/chrome_application_mac.mm @@ -69,4 +69,8 @@ ScopedSendingEvent::~ScopedSendingEvent() { [app_ setHandlingSendEvent:handling_]; } +void RegisterCrApp() { + [CrApplication sharedApplication]; +} + } // namespace chrome_application_mac diff --git a/chrome/common/sandbox_mac.mm b/chrome/common/sandbox_mac.mm index 56ad0b1672ca2..b5f9d2210038d 100644 --- a/chrome/common/sandbox_mac.mm +++ b/chrome/common/sandbox_mac.mm @@ -263,10 +263,6 @@ void Sandbox::SandboxWarmup(SandboxProcessType sandbox_type) { // Access to /dev/random is required for the field trial code. GetUrandomFD(); } - - { // Without this, the GPU process dies during [CrApplication init]. - [CrApplication sharedApplication]; - } break; default: diff --git a/chrome/gpu/gpu_main.cc b/chrome/gpu/gpu_main.cc index e370ce3363374..2464c2f163cc4 100644 --- a/chrome/gpu/gpu_main.cc +++ b/chrome/gpu/gpu_main.cc @@ -25,6 +25,7 @@ #endif #if defined(OS_MACOSX) +#include "chrome/common/chrome_application_mac.h" #include "chrome/common/sandbox_mac.h" #endif @@ -75,6 +76,10 @@ int GpuMain(const MainFunctionParams& parameters) { ChildProcess::WaitForDebugger(L"Gpu"); } +#if defined(OS_MACOSX) + chrome_application_mac::RegisterCrApp(); +#endif + MessageLoop main_message_loop(MessageLoop::TYPE_UI); PlatformThread::SetName("CrGpuMain"); -- GitLab