cc59f8b125
Original change's description: > Switch tracing to use v8::TracingController > > BUG=v8:6511 > R=fmeawad@chromium.org > > Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng > Change-Id: I4961e4b61a9ddc98385ed97c3ffcbcaef2d9cba7 > Reviewed-on: https://chromium-review.googlesource.com/543144 > Commit-Queue: Jochen Eisinger <jochen@chromium.org> > Reviewed-by: Fadi Meawad <fmeawad@chromium.org> > Cr-Commit-Position: refs/heads/master@{#46307} BUG=v8:6511 TBR=fmeawad@chromium.org Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng;master.tryserver.v8:v8_linux64_tsan_rel Change-Id: Ide32b409248dfd466e7c0bae1d8ae61d6a955d98 Reviewed-on: https://chromium-review.googlesource.com/558865 Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#46381}
84 lines
3.1 KiB
C++
84 lines
3.1 KiB
C++
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
|
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
|
|
|
#include "libplatform/libplatform-export.h"
|
|
#include "libplatform/v8-tracing.h"
|
|
#include "v8-platform.h" // NOLINT(build/include)
|
|
|
|
namespace v8 {
|
|
namespace platform {
|
|
|
|
enum class IdleTaskSupport { kDisabled, kEnabled };
|
|
enum class InProcessStackDumping { kDisabled, kEnabled };
|
|
|
|
enum class MessageLoopBehavior : bool {
|
|
kDoNotWait = false,
|
|
kWaitForWork = true
|
|
};
|
|
|
|
/**
|
|
* Returns a new instance of the default v8::Platform implementation.
|
|
*
|
|
* The caller will take ownership of the returned pointer. |thread_pool_size|
|
|
* is the number of worker threads to allocate for background jobs. If a value
|
|
* of zero is passed, a suitable default based on the current number of
|
|
* processors online will be chosen.
|
|
* 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,
|
|
v8::TracingController* tracing_controller = nullptr);
|
|
|
|
/**
|
|
* Pumps the message loop for the given isolate.
|
|
*
|
|
* The caller has to make sure that this is called from the right thread.
|
|
* Returns true if a task was executed, and false otherwise. Unless requested
|
|
* through the |behavior| parameter, this call does not block if no task is
|
|
* pending. The |platform| has to be created using |CreateDefaultPlatform|.
|
|
*/
|
|
V8_PLATFORM_EXPORT bool PumpMessageLoop(
|
|
v8::Platform* platform, v8::Isolate* isolate,
|
|
MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait);
|
|
|
|
V8_PLATFORM_EXPORT void EnsureEventLoopInitialized(v8::Platform* platform,
|
|
v8::Isolate* isolate);
|
|
|
|
/**
|
|
* Runs pending idle tasks for at most |idle_time_in_seconds| seconds.
|
|
*
|
|
* The caller has to make sure that this is called from the right thread.
|
|
* This call does not block if no task is pending. The |platform| has to be
|
|
* created using |CreateDefaultPlatform|.
|
|
*/
|
|
V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|
v8::Isolate* isolate,
|
|
double idle_time_in_seconds);
|
|
|
|
/**
|
|
* Attempts to set the tracing controller for the given platform.
|
|
*
|
|
* The |platform| has to be created using |CreateDefaultPlatform|.
|
|
*
|
|
* DEPRECATED: Will be removed soon.
|
|
*/
|
|
V8_PLATFORM_EXPORT void SetTracingController(
|
|
v8::Platform* platform,
|
|
v8::platform::tracing::TracingController* tracing_controller);
|
|
|
|
} // namespace platform
|
|
} // namespace v8
|
|
|
|
#endif // V8_LIBPLATFORM_LIBPLATFORM_H_
|