Commit c79ae4c2 authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Revert "Allow FROM_HERE to be backed by base::Location::Current()."

This reverts commit 6c9388f9.

Reason for revert: Broke compile on ios-device-xcode-clang bot: https://ci.chromium.org/p/chromium/builders/ci/ios-device-xcode-clang/120239

Original change's description:
> Allow FROM_HERE to be backed by base::Location::Current().
> 
> This allows the functionality of base::Location::Current() to be
> verified in releases while still allowing a simple revert.
> 
> One minor difference from before is that the helper macro
> FROM_HERE_WITH_EXPLICIT_FUNCTION is no longer supported. Since
> cc::BeginFrameTracker is the only user of this macro and doesn't
> appear to need it, just revert it to use FROM_HERE directly.
> 
> Bug: 974061
> Change-Id: Iae09bc02caf9f095a3ace9ea3ac70ded3dd493e4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1990262
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Auto-Submit: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#731804}

TBR=danakj@chromium.org,dcheng@chromium.org,jbroman@chromium.org,altimin@chromium.org

Change-Id: I4d545b08f3e784cb9302ad1fb1541741296af726
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 974061
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000439Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731812}
parent 2c0de225
...@@ -53,13 +53,6 @@ declare_args() { ...@@ -53,13 +53,6 @@ declare_args() {
# file name) is saved. # file name) is saved.
enable_location_source = true enable_location_source = true
# Whether or not the FROM_HERE macro uses base::Location::Current(). This
# allows the implementation to be reverted if needed while validating its
# replacement base::Location::Current(). On by default in non-official builds
# for testing purposes.
# TODO(https://crbug.com/974061): remove this eventually.
from_here_uses_location_builtins = !is_official_build
# Unsafe developer build. Has developer-friendly features that may weaken or # Unsafe developer build. Has developer-friendly features that may weaken or
# disable security measures like sandboxing or ASLR. # disable security measures like sandboxing or ASLR.
# IMPORTANT: Unsafe developer builds should never be distributed to end users. # IMPORTANT: Unsafe developer builds should never be distributed to end users.
...@@ -2104,7 +2097,6 @@ buildflag_header("debugging_buildflags") { ...@@ -2104,7 +2097,6 @@ buildflag_header("debugging_buildflags") {
flags = [ flags = [
"ENABLE_LOCATION_SOURCE=$enable_location_source", "ENABLE_LOCATION_SOURCE=$enable_location_source",
"FROM_HERE_USES_LOCATION_BUILTINS=$from_here_uses_location_builtins",
"ENABLE_PROFILING=$enable_profiling", "ENABLE_PROFILING=$enable_profiling",
"CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers", "CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers",
"UNSAFE_DEVELOPER_BUILD=$is_unsafe_developer_build", "UNSAFE_DEVELOPER_BUILD=$is_unsafe_developer_build",
......
...@@ -57,16 +57,11 @@ std::string Location::ToString() const { ...@@ -57,16 +57,11 @@ std::string Location::ToString() const {
#define RETURN_ADDRESS() nullptr #define RETURN_ADDRESS() nullptr
#endif #endif
#if !BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
#if !BUILDFLAG(ENABLE_LOCATION_SOURCE)
// static // static
NOINLINE Location Location::CreateFromHere(const char* file_name) { NOINLINE Location Location::CreateFromHere(const char* file_name) {
return Location(file_name, RETURN_ADDRESS()); return Location(file_name, RETURN_ADDRESS());
} }
#else
// static // static
NOINLINE Location Location::CreateFromHere(const char* function_name, NOINLINE Location Location::CreateFromHere(const char* function_name,
const char* file_name, const char* file_name,
...@@ -74,9 +69,6 @@ NOINLINE Location Location::CreateFromHere(const char* function_name, ...@@ -74,9 +69,6 @@ NOINLINE Location Location::CreateFromHere(const char* function_name,
return Location(function_name, file_name, line_number, RETURN_ADDRESS()); return Location(function_name, file_name, line_number, RETURN_ADDRESS());
} }
#endif
#endif
#if SUPPORTS_LOCATION_BUILTINS && BUILDFLAG(ENABLE_LOCATION_SOURCE) #if SUPPORTS_LOCATION_BUILTINS && BUILDFLAG(ENABLE_LOCATION_SOURCE)
// static // static
NOINLINE Location Location::Current(const char* function_name, NOINLINE Location Location::Current(const char* function_name,
......
...@@ -83,15 +83,10 @@ class BASE_EXPORT Location { ...@@ -83,15 +83,10 @@ class BASE_EXPORT Location {
// are not available, this will return "pc:<hex address>". // are not available, this will return "pc:<hex address>".
std::string ToString() const; std::string ToString() const;
#if !BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
#if !BUILDFLAG(ENABLE_LOCATION_SOURCE)
static Location CreateFromHere(const char* file_name); static Location CreateFromHere(const char* file_name);
#else
static Location CreateFromHere(const char* function_name, static Location CreateFromHere(const char* function_name,
const char* file_name, const char* file_name,
int line_number); int line_number);
#endif
#endif
#if SUPPORTS_LOCATION_BUILTINS && BUILDFLAG(ENABLE_LOCATION_SOURCE) #if SUPPORTS_LOCATION_BUILTINS && BUILDFLAG(ENABLE_LOCATION_SOURCE)
static Location Current(const char* function_name = __builtin_FUNCTION(), static Location Current(const char* function_name = __builtin_FUNCTION(),
...@@ -112,20 +107,20 @@ class BASE_EXPORT Location { ...@@ -112,20 +107,20 @@ class BASE_EXPORT Location {
BASE_EXPORT const void* GetProgramCounter(); BASE_EXPORT const void* GetProgramCounter();
#if BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
#define FROM_HERE ::base::Location::Current()
// The macros defined here will expand to the current function. // The macros defined here will expand to the current function.
#elif BUILDFLAG(ENABLE_LOCATION_SOURCE) #if BUILDFLAG(ENABLE_LOCATION_SOURCE)
// Full source information should be included. // Full source information should be included.
#define FROM_HERE ::base::Location::CreateFromHere(__func__, __FILE__, __LINE__) #define FROM_HERE FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)
#define FROM_HERE_WITH_EXPLICIT_FUNCTION(function_name) \
::base::Location::CreateFromHere(function_name, __FILE__, __LINE__)
#else #else
// TODO(http://crbug.com/760702) remove the __FILE__ argument from these calls. // TODO(http://crbug.com/760702) remove the __FILE__ argument from these calls.
#define FROM_HERE ::base::Location::CreateFromHere(__FILE__) #define FROM_HERE ::base::Location::CreateFromHere(__FILE__)
#define FROM_HERE_WITH_EXPLICIT_FUNCTION(function_name) \
::base::Location::CreateFromHere(function_name, __FILE__, -1)
#endif #endif
......
...@@ -34,8 +34,6 @@ TEST(LocationTest, CurrentYieldsCorrectValue) { ...@@ -34,8 +34,6 @@ TEST(LocationTest, CurrentYieldsCorrectValue) {
#endif #endif
#elif defined(OFFICIAL_BUILD) #elif defined(OFFICIAL_BUILD)
#error Location builtins must be supported in official builds. #error Location builtins must be supported in official builds.
#elif BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
#error FROM_HERE requires location builtins to be supported.
#endif #endif
ALLOW_UNUSED_LOCAL(previous_line); ALLOW_UNUSED_LOCAL(previous_line);
} }
......
...@@ -8,11 +8,14 @@ ...@@ -8,11 +8,14 @@
#include <set> #include <set>
#include <string> #include <string>
#include "base/location.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "cc/cc_export.h" #include "cc/cc_export.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h" #include "components/viz/common/frame_sinks/begin_frame_args.h"
#define BEGINFRAMETRACKER_FROM_HERE FROM_HERE_WITH_EXPLICIT_FUNCTION("")
namespace perfetto { namespace perfetto {
namespace protos { namespace protos {
namespace pbzero { namespace pbzero {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
...@@ -40,7 +39,7 @@ Scheduler::Scheduler( ...@@ -40,7 +39,7 @@ Scheduler::Scheduler(
layer_tree_host_id_(layer_tree_host_id), layer_tree_host_id_(layer_tree_host_id),
task_runner_(task_runner), task_runner_(task_runner),
compositor_timing_history_(std::move(compositor_timing_history)), compositor_timing_history_(std::move(compositor_timing_history)),
begin_impl_frame_tracker_(FROM_HERE), begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
state_machine_(settings) { state_machine_(settings) {
TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue()); TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue());
DCHECK(client_); DCHECK(client_);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "base/debug/crash_logging.h" #include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h" #include "base/debug/dump_without_crashing.h"
#include "base/location.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/read_only_shared_memory_region.h" #include "base/memory/read_only_shared_memory_region.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
...@@ -247,7 +246,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( ...@@ -247,7 +246,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
: client_(client), : client_(client),
scheduling_client_(scheduling_client), scheduling_client_(scheduling_client),
task_runner_provider_(task_runner_provider), task_runner_provider_(task_runner_provider),
current_begin_frame_tracker_(FROM_HERE), current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
compositor_frame_reporting_controller_( compositor_frame_reporting_controller_(
std::make_unique<CompositorFrameReportingController>( std::make_unique<CompositorFrameReportingController>(
settings.single_thread_proxy_scheduler)), settings.single_thread_proxy_scheduler)),
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "components/viz/test/begin_frame_source_test.h" #include "components/viz/test/begin_frame_source_test.h"
#include "base/location.h"
#include "components/viz/test/begin_frame_args_test.h" #include "components/viz/test/begin_frame_args_test.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -34,7 +33,8 @@ const BeginFrameArgs MockBeginFrameObserver::kDefaultBeginFrameArgs = ...@@ -34,7 +33,8 @@ const BeginFrameArgs MockBeginFrameObserver::kDefaultBeginFrameArgs =
#ifdef NDEBUG #ifdef NDEBUG
nullptr, nullptr,
#else #else
FROM_HERE, FROM_HERE_WITH_EXPLICIT_FUNCTION(
"MockBeginFrameObserver::kDefaultBeginFrameArgs"),
#endif #endif
BeginFrameArgs::kManualSourceId, BeginFrameArgs::kManualSourceId,
BeginFrameArgs::kStartingFrameNumber, BeginFrameArgs::kStartingFrameNumber,
......
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