blob: bfed33ecd3e6642f06698e609bb17ae944709669 [file] [log] [blame]
/*
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef COBALT_SCRIPT_MOZJS_MOZJS_ENGINE_H_
#define COBALT_SCRIPT_MOZJS_MOZJS_ENGINE_H_
#include "base/threading/thread_checker.h"
#include "cobalt/script/javascript_engine.h"
#include "third_party/mozjs/js/src/jsapi.h"
namespace cobalt {
namespace script {
namespace mozjs {
class MozjsEngine : public JavaScriptEngine {
public:
MozjsEngine();
~MozjsEngine() OVERRIDE;
scoped_refptr<GlobalObjectProxy> CreateGlobalObjectProxy() OVERRIDE;
void CollectGarbage() OVERRIDE;
void ReportExtraMemoryCost(size_t bytes) OVERRIDE;
private:
base::ThreadChecker thread_checker_;
// Top-level object that represents the Javascript engine. Typically there is
// one per process, but it's allowed to have multiple.
JSRuntime* runtime_;
};
} // namespace mozjs
} // namespace script
} // namespace cobalt
#endif // COBALT_SCRIPT_MOZJS_MOZJS_ENGINE_H_