OLD | NEW |
1 #include <vector> | 1 #include <vector> |
2 #include <stdexcept> | 2 #include <stdexcept> |
3 | 3 |
4 #include "GlobalJsObject.h" | 4 #include "GlobalJsObject.h" |
5 #include "Thread.h" | 5 #include "Thread.h" |
6 | 6 |
7 using namespace AdblockPlus; | 7 using namespace AdblockPlus; |
8 | 8 |
9 namespace | 9 namespace |
10 { | 10 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 for (Values::iterator it = functionArguments.begin(); | 43 for (Values::iterator it = functionArguments.begin(); |
44 it != functionArguments.end(); it++) | 44 it != functionArguments.end(); it++) |
45 it->Dispose(isolate); | 45 it->Dispose(isolate); |
46 } | 46 } |
47 | 47 |
48 void Run() | 48 void Run() |
49 { | 49 { |
50 Sleep(delay); | 50 Sleep(delay); |
51 const v8::Locker locker(isolate); | 51 const v8::Locker locker(isolate); |
52 const v8::HandleScope handleScope; | 52 const v8::HandleScope handleScope; |
53 v8::Handle<v8::Value> *argv = functionArguments.empty() ? 0 : &(functionAr
guments.front()); | 53 v8::Handle<v8::Value>* argv = functionArguments.empty() ? 0 : &(functionAr
guments.front()); |
54 function->Call(function, functionArguments.size(), argv); | 54 function->Call(function, functionArguments.size(), argv); |
55 delete this; | 55 delete this; |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 typedef v8::Persistent<v8::Value> Value; | 59 typedef v8::Persistent<v8::Value> Value; |
60 typedef std::vector<Value> Values; | 60 typedef std::vector<Value> Values; |
61 | 61 |
62 v8::Isolate* const isolate; | 62 v8::Isolate* const isolate; |
63 v8::Persistent<v8::Function> function; | 63 v8::Persistent<v8::Function> function; |
(...skipping 28 matching lines...) Expand all Loading... |
92 v8::HandleScope handleScope; | 92 v8::HandleScope handleScope; |
93 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 93 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
94 const v8::Handle<v8::ObjectTemplate> console = | 94 const v8::Handle<v8::ObjectTemplate> console = |
95 AdblockPlus::ConsoleJsObject::Create(errorCallback); | 95 AdblockPlus::ConsoleJsObject::Create(errorCallback); |
96 global->Set(v8::String::New("console"), console); | 96 global->Set(v8::String::New("console"), console); |
97 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = | 97 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = |
98 v8::FunctionTemplate::New(SetTimeoutCallback); | 98 v8::FunctionTemplate::New(SetTimeoutCallback); |
99 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); | 99 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); |
100 return handleScope.Close(global); | 100 return handleScope.Close(global); |
101 } | 101 } |
OLD | NEW |