Commit 07a4402b authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cleanup] Decrease v8.h exposure through blink headers

Exposing v8.h in blink headers increases coupling in chromium and requires
defines from V8 to be present in all includers of those blink headers.

This CL removes "v8/include/v8.h from three headers and moves it into .cc
files instead.

Bug: v8:8788
Change-Id: I1f3e172e414d53cc01493f4ca36ad5a3bad00987
Reviewed-on: https://chromium-review.googlesource.com/c/1475176
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632844}
parent c68cd914
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_SCHEDULER_WEB_RAIL_MODE_OBSERVER_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_SCHEDULER_WEB_RAIL_MODE_OBSERVER_H_
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
#include "v8/include/v8.h"
namespace v8 {
enum RAILMode : unsigned;
}
namespace blink { namespace blink {
namespace scheduler { namespace scheduler {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_input_event_result.h" #include "third_party/blink/public/platform/web_input_event_result.h"
#include "third_party/blink/public/platform/web_scoped_virtual_time_pauser.h" #include "third_party/blink/public/platform/web_scoped_virtual_time_pauser.h"
#include "v8/include/v8.h"
namespace base { namespace base {
namespace trace_event { namespace trace_event {
......
...@@ -201,6 +201,21 @@ ThreadState::ThreadState() ...@@ -201,6 +201,21 @@ ThreadState::ThreadState()
heap_ = std::make_unique<ThreadHeap>(this); heap_ = std::make_unique<ThreadHeap>(this);
} }
// Implementation for WebRAILModeObserver
void ThreadState::OnRAILModeChanged(v8::RAILMode new_mode) {
should_optimize_for_load_time_ = new_mode == v8::RAILMode::PERFORMANCE_LOAD;
// When switching RAIL mode to load we try to avoid incremental marking as
// the write barrier cost is noticeable on throughput and garbage
// accumulated during loading is likely to be alive during that phase. The
// same argument holds for unified heap garbage collections with the
// difference that these collections are triggered by V8 and should thus be
// avoided on that end.
if (should_optimize_for_load_time_ && IsIncrementalMarking() &&
!IsUnifiedGCMarkingInProgress() &&
GetGCState() == GCState::kIncrementalMarkingStepScheduled)
ScheduleIncrementalMarkingFinalize();
}
ThreadState::~ThreadState() { ThreadState::~ThreadState() {
DCHECK(CheckThread()); DCHECK(CheckThread());
if (IsMainThread()) if (IsMainThread())
......
...@@ -534,19 +534,7 @@ class PLATFORM_EXPORT ThreadState final ...@@ -534,19 +534,7 @@ class PLATFORM_EXPORT ThreadState final
MarkingVisitor* CurrentVisitor() { return current_gc_data_.visitor.get(); } MarkingVisitor* CurrentVisitor() { return current_gc_data_.visitor.get(); }
// Implementation for WebRAILModeObserver // Implementation for WebRAILModeObserver
void OnRAILModeChanged(v8::RAILMode new_mode) override { void OnRAILModeChanged(v8::RAILMode new_mode) override;
should_optimize_for_load_time_ = new_mode == v8::RAILMode::PERFORMANCE_LOAD;
// When switching RAIL mode to load we try to avoid incremental marking as
// the write barrier cost is noticeable on throughput and garbage
// accumulated during loading is likely to be alive during that phase. The
// same argument holds for unified heap garbage collections with the
// difference that these collections are triggered by V8 and should thus be
// avoided on that end.
if (should_optimize_for_load_time_ && IsIncrementalMarking() &&
!IsUnifiedGCMarkingInProgress() &&
GetGCState() == GCState::kIncrementalMarkingStepScheduled)
ScheduleIncrementalMarkingFinalize();
}
private: private:
// Stores whether some ThreadState is currently in incremental marking. // Stores whether some ThreadState is currently in incremental marking.
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/marking_visitor.h" #include "third_party/blink/renderer/platform/heap/marking_visitor.h"
namespace v8 {
class EmbedderHeapTracer;
}
namespace blink { namespace blink {
struct WrapperTypeInfo; struct WrapperTypeInfo;
......
...@@ -39,7 +39,10 @@ ...@@ -39,7 +39,10 @@
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/hash_traits.h" #include "third_party/blink/renderer/platform/wtf/hash_traits.h"
#include "third_party/blink/renderer/platform/wtf/type_traits.h" #include "third_party/blink/renderer/platform/wtf/type_traits.h"
#include "v8/include/v8.h"
namespace v8 {
class Value;
}
namespace blink { namespace blink {
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h"
#include "third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.h"
#include "v8/include/v8.h"
namespace blink { namespace blink {
namespace scheduler { namespace scheduler {
...@@ -1999,6 +2000,14 @@ void MainThreadSchedulerImpl::TaskQueuePolicy::AsValueInto( ...@@ -1999,6 +2000,14 @@ void MainThreadSchedulerImpl::TaskQueuePolicy::AsValueInto(
state->SetBoolean("use_virtual_time", use_virtual_time); state->SetBoolean("use_virtual_time", use_virtual_time);
} }
MainThreadSchedulerImpl::Policy::Policy()
: rail_mode_(v8::PERFORMANCE_ANIMATION),
should_disable_throttling_(false),
frozen_when_backgrounded_(false),
compositor_priority_(
base::sequence_manager::TaskQueue::QueuePriority::kNormalPriority),
use_case_(UseCase::kNone) {}
void MainThreadSchedulerImpl::Policy::AsValueInto( void MainThreadSchedulerImpl::Policy::AsValueInto(
base::trace_event::TracedValue* state) const { base::trace_event::TracedValue* state) const {
state->BeginDictionary("compositor_queue_policy"); state->BeginDictionary("compositor_queue_policy");
......
...@@ -457,14 +457,7 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl ...@@ -457,14 +457,7 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl
class Policy { class Policy {
public: public:
Policy() Policy();
: rail_mode_(v8::PERFORMANCE_ANIMATION),
should_disable_throttling_(false),
frozen_when_backgrounded_(false),
compositor_priority_(base::sequence_manager::TaskQueue::
QueuePriority::kNormalPriority),
use_case_(UseCase::kNone) {}
~Policy() = default; ~Policy() = default;
TaskQueuePolicy& compositor_queue_policy() { TaskQueuePolicy& compositor_queue_policy() {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h"
#include "third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "v8/include/v8.h"
using base::sequence_manager::TaskQueue; using base::sequence_manager::TaskQueue;
......
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