71bb00e261
FINAL implies OVERRIDE, which in turn implies virtual, so there's no need to use more than one of these. The Google C++ style guide even requires this, see http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Inheritance. While we're here, port r24662 to x87. The net result is that v8 compiles again with a current clang. BUG=v8:3753 LOG=y Review URL: https://codereview.chromium.org/797943002 Cr-Commit-Position: refs/heads/master@{#25792}
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
// 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_LIBPLATFORM_DEFAULT_PLATFORM_H_
|
|
#define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
|
|
|
|
#include <map>
|
|
#include <queue>
|
|
#include <vector>
|
|
|
|
#include "include/v8-platform.h"
|
|
#include "src/base/macros.h"
|
|
#include "src/base/platform/mutex.h"
|
|
#include "src/libplatform/task-queue.h"
|
|
|
|
namespace v8 {
|
|
namespace platform {
|
|
|
|
class TaskQueue;
|
|
class Thread;
|
|
class WorkerThread;
|
|
|
|
class DefaultPlatform : public Platform {
|
|
public:
|
|
DefaultPlatform();
|
|
virtual ~DefaultPlatform();
|
|
|
|
void SetThreadPoolSize(int thread_pool_size);
|
|
|
|
void EnsureInitialized();
|
|
|
|
bool PumpMessageLoop(v8::Isolate* isolate);
|
|
|
|
// v8::Platform implementation.
|
|
virtual void CallOnBackgroundThread(
|
|
Task* task, ExpectedRuntime expected_runtime) OVERRIDE;
|
|
virtual void CallOnForegroundThread(v8::Isolate* isolate,
|
|
Task* task) OVERRIDE;
|
|
double MonotonicallyIncreasingTime() OVERRIDE;
|
|
|
|
private:
|
|
static const int kMaxThreadPoolSize;
|
|
|
|
base::Mutex lock_;
|
|
bool initialized_;
|
|
int thread_pool_size_;
|
|
std::vector<WorkerThread*> thread_pool_;
|
|
TaskQueue queue_;
|
|
std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
|
|
};
|
|
|
|
|
|
} } // namespace v8::platform
|
|
|
|
|
|
#endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
|