2014-07-03 07:37:27 +00:00
|
|
|
// 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_
|
|
|
|
|
2016-10-10 08:51:48 +00:00
|
|
|
#include "libplatform/libplatform-export.h"
|
2016-08-01 16:17:37 +00:00
|
|
|
#include "libplatform/v8-tracing.h"
|
2016-02-29 11:02:52 +00:00
|
|
|
#include "v8-platform.h" // NOLINT(build/include)
|
2014-11-18 20:29:23 +00:00
|
|
|
|
2014-11-19 07:27:48 +00:00
|
|
|
namespace v8 {
|
2014-07-03 07:37:27 +00:00
|
|
|
namespace platform {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2016-10-10 08:51:48 +00:00
|
|
|
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
|
|
|
|
int thread_pool_size = 0);
|
2014-07-03 07:37:27 +00:00
|
|
|
|
2014-07-03 09:33:36 +00:00
|
|
|
/**
|
|
|
|
* 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. This call does
|
|
|
|
* not block if no task is pending. The |platform| has to be created using
|
|
|
|
* |CreateDefaultPlatform|.
|
|
|
|
*/
|
2016-10-10 08:51:48 +00:00
|
|
|
V8_PLATFORM_EXPORT bool PumpMessageLoop(v8::Platform* platform,
|
|
|
|
v8::Isolate* isolate);
|
2014-07-03 09:33:36 +00:00
|
|
|
|
2016-07-27 16:21:09 +00:00
|
|
|
/**
|
|
|
|
* Attempts to set the tracing controller for the given platform.
|
|
|
|
*
|
|
|
|
* The |platform| has to be created using |CreateDefaultPlatform|.
|
|
|
|
*/
|
2016-10-10 08:51:48 +00:00
|
|
|
V8_PLATFORM_EXPORT void SetTracingController(
|
2016-07-27 16:21:09 +00:00
|
|
|
v8::Platform* platform,
|
|
|
|
v8::platform::tracing::TracingController* tracing_controller);
|
2014-07-03 09:33:36 +00:00
|
|
|
|
2014-07-03 07:37:27 +00:00
|
|
|
} // namespace platform
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_LIBPLATFORM_LIBPLATFORM_H_
|