Browse Source

deps: backport 5152d97 from upstream V8

Original commit message:

  Add API to create a platform with a tracing controller
  BUG=v8:6511

  Cq-Include-Trybots:
  master.tryserver.chromium.linux:linux_chromium_rel_ng
  Change-Id: Ie6b62df693d3b847837c071e1f985b7ce3b420c8
  Reviewed-on: https://chromium-review.googlesource.com/548499
  Reviewed-by: Fadi Meawad <fmeawad@chromium.org>
  Commit-Queue: Jochen Eisinger <jochen@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#46227}

PR-URL: https://github.com/nodejs/node/pull/14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
canary-base
Matt Loring 8 years ago
committed by Anna Henningsen
parent
commit
832a87f906
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 5
      deps/v8/include/libplatform/libplatform.h
  2. 16
      deps/v8/src/libplatform/default-platform.cc
  3. 8
      deps/v8/src/libplatform/default-platform.h

5
deps/v8/include/libplatform/libplatform.h

@ -30,12 +30,15 @@ enum class MessageLoopBehavior : bool {
* If |idle_task_support| is enabled then the platform will accept idle
* tasks (IdleTasksEnabled will return true) and will rely on the embedder
* calling v8::platform::RunIdleTasks to process the idle tasks.
* If |tracing_controller| is nullptr, the default platform will create a
* v8::platform::TracingController instance and use it.
*/
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping =
InProcessStackDumping::kEnabled);
InProcessStackDumping::kEnabled,
v8::TracingController* tracing_controller = nullptr);
/**
* Pumps the message loop for the given isolate.

16
deps/v8/src/libplatform/default-platform.cc

@ -29,15 +29,18 @@ void PrintStackTrace() {
} // namespace
v8::Platform* CreateDefaultPlatform(
int thread_pool_size, IdleTaskSupport idle_task_support,
InProcessStackDumping in_process_stack_dumping) {
v8::Platform* CreateDefaultPlatform(int thread_pool_size,
IdleTaskSupport idle_task_support,
InProcessStackDumping in_process_stack_dumping,
v8::TracingController* tracing_controller) {
if (in_process_stack_dumping == InProcessStackDumping::kEnabled) {
v8::base::debug::EnableInProcessStackDumping();
}
DefaultPlatform* platform = new DefaultPlatform(idle_task_support);
platform->SetThreadPoolSize(thread_pool_size);
platform->EnsureInitialized();
if (tracing_controller != nullptr)
platform->SetTracingController(tracing_controller);
return platform;
}
@ -73,11 +76,6 @@ DefaultPlatform::DefaultPlatform(IdleTaskSupport idle_task_support)
idle_task_support_(idle_task_support) {}
DefaultPlatform::~DefaultPlatform() {
if (tracing_controller_) {
tracing_controller_->StopTracing();
tracing_controller_.reset();
}
base::LockGuard<base::Mutex> guard(&lock_);
queue_.Terminate();
if (initialized_) {
@ -316,7 +314,7 @@ const char* DefaultPlatform::GetCategoryGroupName(
}
void DefaultPlatform::SetTracingController(
tracing::TracingController* tracing_controller) {
TracingController* tracing_controller) {
tracing_controller_.reset(tracing_controller);
}

8
deps/v8/src/libplatform/default-platform.h

@ -27,10 +27,6 @@ class TaskQueue;
class Thread;
class WorkerThread;
namespace tracing {
class TracingController;
}
class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) {
public:
explicit DefaultPlatform(
@ -72,7 +68,7 @@ class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) {
unsigned int flags) override;
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name, uint64_t handle) override;
void SetTracingController(tracing::TracingController* tracing_controller);
void SetTracingController(TracingController* tracing_controller);
void AddTraceStateObserver(TraceStateObserver* observer) override;
void RemoveTraceStateObserver(TraceStateObserver* observer) override;
@ -103,7 +99,7 @@ class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) {
std::priority_queue<DelayedEntry, std::vector<DelayedEntry>,
std::greater<DelayedEntry> > >
main_thread_delayed_queue_;
std::unique_ptr<tracing::TracingController> tracing_controller_;
std::unique_ptr<TracingController> tracing_controller_;
DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
};

Loading…
Cancel
Save