Sha256: 4373c9da7e2afd46a48ea941b0ea7655872d52e8b5253bd14c053c25655e0ca9

Contents?: true

Size: 1.68 KB

Versions: 12

Compression:

Stored size: 1.68 KB

Contents

// Copyright 2013 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_V8_PLATFORM_H_
#define V8_V8_PLATFORM_H_

namespace v8 {

class Isolate;

/**
 * A Task represents a unit of work.
 */
class Task {
 public:
  virtual ~Task() {}

  virtual void Run() = 0;
};

/**
 * V8 Platform abstraction layer.
 *
 * The embedder has to provide an implementation of this interface before
 * initializing the rest of V8.
 */
class Platform {
 public:
  /**
   * This enum is used to indicate whether a task is potentially long running,
   * or causes a long wait. The embedder might want to use this hint to decide
   * whether to execute the task on a dedicated thread.
   */
  enum ExpectedRuntime {
    kShortRunningTask,
    kLongRunningTask
  };

  virtual ~Platform() {}

  /**
   * Schedules a task to be invoked on a background thread. |expected_runtime|
   * indicates that the task will run a long time. The Platform implementation
   * takes ownership of |task|. There is no guarantee about order of execution
   * of tasks wrt order of scheduling, nor is there a guarantee about the
   * thread the task will be run on.
   */
  virtual void CallOnBackgroundThread(Task* task,
                                      ExpectedRuntime expected_runtime) = 0;

  /**
   * Schedules a task to be invoked on a foreground thread wrt a specific
   * |isolate|. Tasks posted for the same isolate should be execute in order of
   * scheduling. The definition of "foreground" is opaque to V8.
   */
  virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;
};

}  // namespace v8

#endif  // V8_V8_PLATFORM_H_

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
virgil-crypto-2.1.2.2 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.1.2.1 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.1.2 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.1.0 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.7 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.6r4 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.6r3 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.6r2 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.6r1 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.2b2 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.2b1 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h
virgil-crypto-2.0.2b0 ext/native/src/wrappers/nodejs/node-v0.12.7/include/v8-platform.h