Commit 1dc5e802 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

mac: Add a Feature to control CanInvalidateCFRunLoopTimers()

This adds the MessagePumpMacTimerInvalidation feature to control whether
or not the MessagePumpMac's CFRunLoopTimer invalidation hack is enabled.
This will be used to A/B test its efficacy, now that MessagePumpMac has
switched to DoSomeWork().

Bug: 925998
Change-Id: I1e62d3a679c7590f4674a8d0f44b936b82856534
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036394Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750979}
parent 04f7b20f
......@@ -10,6 +10,7 @@
#include <memory>
#include "base/auto_reset.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/mac/call_with_eh_frame.h"
#include "base/mac/scoped_cftyperef.h"
......@@ -52,6 +53,9 @@ bool g_not_using_cr_app = false;
// The MessagePump controlling [NSApp run].
MessagePumpNSApplication* g_app_pump;
Feature kMessagePumpTimerInvalidation{"MessagePumpMacTimerInvalidation",
FEATURE_ENABLED_BY_DEFAULT};
// Various CoreFoundation definitions.
typedef struct __CFRuntimeBase {
uintptr_t _cfisa;
......@@ -368,6 +372,10 @@ int MessagePumpCFRunLoopBase::GetModeMask() const {
// uses public API to confirm that the private API changed the correct bit.
// static
bool MessagePumpCFRunLoopBase::CanInvalidateCFRunLoopTimers() {
if (!FeatureList::IsEnabled(kMessagePumpTimerInvalidation)) {
return false;
}
CFRunLoopTimerContext timer_context = CFRunLoopTimerContext();
timer_context.info = nullptr;
ScopedCFTypeRef<CFRunLoopTimerRef> test_timer(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment