New issue
Advanced search Search tips

Issue 917698 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

DCHECK for views examples on macOS

Reported by vladbe...@yandex-team.ru, Dec 24

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3651.0 Safari/537.36

Steps to reproduce the problem:
1. Compile views_examples_with_content_exe with dcheck_is_always_on
2. Run views_examples_with_content_exe

What is the expected behavior?
Correct running example

What went wrong?
DCHECK happens at https://chromium.googlesource.com/chromium/src/+blame/master/content/browser/scheduler/responsiveness/native_event_observer_mac.mm#15 (Check failed: [NSApp conformsToProtocol:@protocol(NativeEventProcessor)])

content::responsiveness::NativeEventObserver::RegisterObserver()
content::responsiveness::NativeEventObserver::NativeEventObserver(base::RepeatingCallback<void (void const*)>, base::RepeatingCallback<void (void const*)>)
content::responsiveness::NativeEventObserver::NativeEventObserver(base::RepeatingCallback<void (void const*)>, base::RepeatingCallback<void (void const*)>)
std::__1::__unique_if<content::responsiveness::NativeEventObserver>::__unique_single std::__1::make_unique<content::responsiveness::NativeEventObserver, base::RepeatingCallback<void (void const*)>, base::RepeatingCallback<void (void const*)> >(base::RepeatingCallback<void (void const*)>&&, base::RepeatingCallback<void (void const*)>&&)
content::responsiveness::Watcher::CreateNativeEventObserver()
content::responsiveness::Watcher::SetUp()
content::BrowserMainLoop::BrowserThreadsStarted()
int base::internal::FunctorTraits<int (content::BrowserMainLoop::*)(), void>::Invoke<int (content::BrowserMainLoop::*)(), content::BrowserMainLoop*>(int (content::BrowserMainLoop::*)(), content::BrowserMainLoop*&&)
int base::internal::InvokeHelper<false, int>::MakeItSo<int (content::BrowserMainLoop::* const&)(), content::BrowserMainLoop*>(int (content::BrowserMainLoop::* const&&&)(), content::BrowserMainLoop*&&)
int base::internal::Invoker<base::internal::BindState<int (content::BrowserMainLoop::*)(), base::internal::UnretainedWrapper<content::BrowserMainLoop> >, int ()>::RunImpl<int (content::BrowserMainLoop::* const&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::BrowserMainLoop> > const&, 0ul>(int (content::BrowserMainLoop::* const&&&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::BrowserMainLoop> > const&&&, std::__1::integer_sequence<unsigned long, 0ul>)
base::internal::Invoker<base::internal::BindState<int (content::BrowserMainLoop::*)(), base::internal::UnretainedWrapper<content::BrowserMainLoop> >, int ()>::Run(base::internal::BindStateBase*)
base::RepeatingCallback<int ()>::Run() const &
content::StartupTaskRunner::RunAllTasksNow()
content::BrowserMainLoop::CreateStartupTasks()
content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&)
content::BrowserMain(content::MainFunctionParams const&)
content::RunBrowserProcessMain(content::MainFunctionParams const&, content::ContentMainDelegate*)
content::ContentMainRunnerImpl::RunServiceManager(content::MainFunctionParams&, bool)
content::ContentMainRunnerImpl::Run(bool)
content::ContentServiceManagerMainDelegate::RunEmbedderProcess()
service_manager::Main(service_manager::MainParams const&)
content::ContentMain(content::ContentMainParams const&)
ui::ViewsContentClient::RunMain()
main
start

Did this work before? Yes Before https://chromium.googlesource.com/chromium/src/+/3f51ab68a022dd6091a2a570424357e848752d00

Chrome version: 73.0.3651.0  Channel: dev
OS Version: OS X 10.12.6
Flash Version: 

All examples that do not register NativeEventProcessor derived applications do crashes.
 
If try run ./views_examples_exe another DCHECK:

Check failed: g_system_power_io_port != 0u (0 vs. 0)
base::debug::StackTrace::StackTrace(unsigned long)
base::debug::StackTrace::StackTrace(unsigned long)
base::debug::StackTrace::StackTrace()
logging::LogMessage::~LogMessage()
logging::LogMessage::~LogMessage()
base::PowerMonitorDeviceSource::PlatformInit()
base::PowerMonitorDeviceSource::PowerMonitorDeviceSource()
base::PowerMonitorDeviceSource::PowerMonitorDeviceSource()
main
start

Components: Internals>Views
Owner: erikc...@chromium.org
Status: Assigned (was: Unconfirmed)
I just tripped over this locally as well. This was introduced I think by erikchen@'s 7d5f0ee834dc7404788b4f521515738f9de482b6.

Erik, can you take a peek please? :)
Owner: ellyjo...@chromium.org
The jank calculator requires that the application's NSApp subclass conform to @protocol(NativeEventProcessor).

To avoid this DCHECK, we either should not instantiate the jank calculator, or the NSApp subclass should conform.

For an example of a trivial implementation, see HeadlessShellCrApplication:
https://cs.chromium.org/chromium/src/headless/lib/browser/headless_shell_application_mac.mm?type=cs&q=@interface+NativeEventProcessor&g=0&l=13

Note that this example [and others] also conform to CrAppProtocol and CrAppControlProtocol. 

another example -- content shell:
https://cs.chromium.org/chromium/src/content/shell/browser/shell_application_mac.h?type=cs&q=CrAppProtocol&g=0&l=11

The jank calculator is instantiated in content/browser/browser_main_loop.cc:
https://cs.chromium.org/chromium/src/content/browser/browser_main_loop.cc?type=cs&q=BrowserMainLoop::BrowserThreadsStarted&sq=package:chromium&g=0&l=1460

Digging into views_examples_with_content_exe, it instantiates a ui::ViewsContentClient, which eventually calls into content/browser/browser_main_loop.cc. 

However, it does not appear to instantiate a ShellCrApplication. I haven't dug too deeply, but it appears to use a non-subclassed NSApp: https://cs.chromium.org/chromium/src/ui/views_content_client/views_content_client_main_parts_mac.mm?l=99

It presumably also does not implement CrAppProtocol, which is required by MessagePumpMac:
https://cs.chromium.org/chromium/src/base/message_loop/message_pump_mac.h?type=cs&q=CrAppProtocol&g=0&l=50

I don't know why views_examples_with_content_exe doesn't use content shell, but it probably should. If it can't use content shell, then it should set up an NSApp subclass that implements NativeEventProcessor, CrAppProtocol and CrAppControlProtocol.

Back over to elly for further triage.
Labels: M-74 Target-74
Thanks Erik! That was the context I needed.

Comment 5 by robliao@chromium.org, Jan 17 (6 days ago)

Labels: Hotlist-DesktopUIConsider

Comment 6 by robliao@chromium.org, Jan 18 (5 days ago)

Labels: Group-Developer_Tools

Sign in to add a comment