summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/chrome_application_mac.h13
-rw-r--r--chrome/common/chrome_application_mac.mm4
-rw-r--r--chrome/common/sandbox_mac.mm4
-rw-r--r--chrome/gpu/gpu_main.cc5
4 files changed, 21 insertions, 5 deletions
diff --git a/chrome/common/chrome_application_mac.h b/chrome/common/chrome_application_mac.h
index 585601d8..2ea557c 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 9bd9f67..3c1b013 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 56ad0b1..b5f9d22 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 e370ce3..2464c2f 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");