#ifndef CHROME_RENDERER_EXTENSIONS_V8_SCHEMA_REGISTRY_H_
#define CHROME_RENDERER_EXTENSIONS_V8_SCHEMA_REGISTRY_H_
#include <map>
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "extensions/renderer/scoped_persistent.h"
#include "v8/include/v8-util.h"
#include "v8/include/v8.h"
namespace extensions {
class NativeHandler;
class V8SchemaRegistry {
public:
V8SchemaRegistry();
~V8SchemaRegistry();
scoped_ptr<NativeHandler> AsNativeHandler();
v8::Handle<v8::Array> GetSchemas(const std::vector<std::string>& apis);
v8::Handle<v8::Object> GetSchema(const std::string& api);
private:
v8::Handle<v8::Context> GetOrCreateContext(v8::Isolate* isolate);
typedef v8::StdPersistentValueMap<std::string, v8::Object> SchemaCache;
scoped_ptr<SchemaCache> schema_cache_;
ScopedPersistent<v8::Context> context_;
DISALLOW_COPY_AND_ASSIGN(V8SchemaRegistry);
};
}
#endif