Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: gin/modules/timer.cc

Issue 126743002: Make the cube spin in the JS mojo app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gin/modules/timer.h" 5 #include "gin/modules/timer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "gin/object_template_builder.h" 8 #include "gin/object_template_builder.h"
9 #include "gin/per_context_data.h" 9 #include "gin/per_context_data.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 Runner::Scope scope(runner_.get()); 58 Runner::Scope scope(runner_.get());
59 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast( 59 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(
60 GetWrapper(runner_->isolate())->GetHiddenValue( 60 GetWrapper(runner_->isolate())->GetHiddenValue(
61 GetHiddenPropertyName(runner_->isolate()))); 61 GetHiddenPropertyName(runner_->isolate())));
62 runner_->Call(function, v8::Undefined(runner_->isolate()), 0, NULL); 62 runner_->Call(function, v8::Undefined(runner_->isolate()), 0, NULL);
63 } 63 }
64 64
65 65
66 // TimerModule 66 // TimerModule
67 67
68 const char TimerModule::kName[] = "timer";
68 WrapperInfo TimerModule::kWrapperInfo = { kEmbedderNativeGin }; 69 WrapperInfo TimerModule::kWrapperInfo = { kEmbedderNativeGin };
69 70
70 // static 71 // static
71 Handle<TimerModule> TimerModule::Create(v8::Isolate* isolate) { 72 Handle<TimerModule> TimerModule::Create(v8::Isolate* isolate) {
72 return CreateHandle(isolate, new TimerModule()); 73 return CreateHandle(isolate, new TimerModule());
73 } 74 }
74 75
75 // static 76 // static
76 v8::Local<v8::Value> TimerModule::GetModule(v8::Isolate* isolate) { 77 v8::Local<v8::Value> TimerModule::GetModule(v8::Isolate* isolate) {
77 return Create(isolate)->GetWrapper(isolate); 78 return Create(isolate)->GetWrapper(isolate);
78 } 79 }
79 80
80 TimerModule::TimerModule() { 81 TimerModule::TimerModule() {
81 } 82 }
82 83
83 TimerModule::~TimerModule() { 84 TimerModule::~TimerModule() {
84 } 85 }
85 86
86 ObjectTemplateBuilder TimerModule::GetObjectTemplateBuilder( 87 ObjectTemplateBuilder TimerModule::GetObjectTemplateBuilder(
87 v8::Isolate* isolate) { 88 v8::Isolate* isolate) {
88 return Wrappable<TimerModule>::GetObjectTemplateBuilder(isolate) 89 return Wrappable<TimerModule>::GetObjectTemplateBuilder(isolate)
89 .SetMethod("createOneShot", 90 .SetMethod("createOneShot",
90 base::Bind(&Timer::Create, Timer::TYPE_ONE_SHOT)) 91 base::Bind(&Timer::Create, Timer::TYPE_ONE_SHOT))
91 .SetMethod("createRepeating", 92 .SetMethod("createRepeating",
92 base::Bind(&Timer::Create, Timer::TYPE_REPEATING)); 93 base::Bind(&Timer::Create, Timer::TYPE_REPEATING));
93 } 94 }
94 95
95 } // namespace gin 96 } // namespace gin
OLDNEW
« no previous file with comments | « gin/modules/timer.h ('k') | mojo/apps/js/main.js » ('j') | mojo/apps/js/main.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698