Use BuildPrototype to build prototype

This saves the step of manually keeping the global template object,
which is easy to forget then leak.
This commit is contained in:
Cheng Zhao 2015-12-03 16:04:46 +08:00
parent 6795bd1d96
commit a15f9fab5b
10 changed files with 148 additions and 126 deletions

View file

@ -141,15 +141,15 @@ class WebContents : public mate::TrackableObject<WebContents>,
v8::Local<v8::Value> Session(v8::Isolate* isolate);
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit WebContents(content::WebContents* web_contents);
WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
~WebContents();
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,
int32 level,