Creates TaskScheduler and MessageLoop on main thread early

1072387
This commit is contained in:
Jeremy Apthorp 2018-10-03 13:49:18 -07:00
parent d3a0a2300b
commit 8eb15f7554
6 changed files with 33 additions and 4 deletions

View file

@ -35,6 +35,10 @@
#include "atom/common/common_message_generator.h"
#endif
#if defined(OS_MACOSX)
#include "atom/app/atom_main_delegate_mac.h"
#endif
namespace atom {
namespace {
@ -158,6 +162,12 @@ void AtomMainDelegate::PreSandboxStartup() {
#endif
}
void AtomMainDelegate::PreContentInitialization() {
#if defined(OS_MACOSX)
RegisterAtomCrApp();
#endif
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
browser_client_.reset(new AtomBrowserClient);
return browser_client_.get();

View file

@ -22,6 +22,7 @@ class AtomMainDelegate : public brightray::MainDelegate {
// content::ContentMainDelegate:
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
void PreContentInitialization() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
content::ContentUtilityClient* CreateContentUtilityClient() override;

View file

@ -0,0 +1,15 @@
// Copyright 2013 Slack Technologies, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_
#define ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_
namespace atom {
// Initializes NSApplication.
void RegisterAtomCrApp();
} // namespace atom
#endif // ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_

View file

@ -4,6 +4,7 @@
#include "atom/app/atom_main_delegate.h"
#include "atom/browser/mac/atom_application.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/bundle_locations.h"
@ -63,4 +64,9 @@ void AtomMainDelegate::SetUpBundleOverrides() {
base::mac::SetBaseBundleID(base_bundle_id.c_str());
}
void RegisterAtomCrApp() {
// Force the NSApplication subclass to be used.
[AtomApplication sharedApplication];
}
} // namespace atom

View file

@ -4,7 +4,6 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/atom_application_delegate.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
@ -13,9 +12,6 @@
namespace atom {
void AtomBrowserMainParts::PreMainMessageLoopStart() {
// Force the NSApplication subclass to be used.
[AtomApplication sharedApplication];
// Set our own application delegate.
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
[NSApp setDelegate:delegate];

View file

@ -112,6 +112,7 @@ filenames = {
"atom/app/atom_content_client.h",
"atom/app/atom_main_delegate.cc",
"atom/app/atom_main_delegate.h",
"atom/app/atom_main_delegate_mac.h",
"atom/app/atom_main_delegate_mac.mm",
"atom/app/command_line_args.cc",
"atom/app/command_line_args.h",