Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/GlobalJsObject.cpp

Issue 10296001: Implement File API (Closed)
Patch Set: Addressed the new issues Created April 16, 2013, 1:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <vector> 1 #include <vector>
2 #include <stdexcept> 2 #include <stdexcept>
3 3
4 #include "ConsoleJsObject.h"
5 #include "FileSystemJsObject.h"
4 #include "GlobalJsObject.h" 6 #include "GlobalJsObject.h"
5 #include "ConsoleJsObject.h" 7 #include "ConsoleJsObject.h"
6 #include "WebRequestJsObject.h" 8 #include "WebRequestJsObject.h"
7 #include "Thread.h" 9 #include "Thread.h"
8 10
9 using namespace AdblockPlus; 11 using namespace AdblockPlus;
10 12
11 namespace 13 namespace
12 { 14 {
13 class TimeoutThread : public Thread 15 class TimeoutThread : public Thread
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 timeoutThread->Start(); 83 timeoutThread->Start();
82 84
83 // We should actually return the timer ID here, which could be 85 // We should actually return the timer ID here, which could be
84 // used via clearTimeout(). But since we don't seem to need 86 // used via clearTimeout(). But since we don't seem to need
85 // clearTimeout(), we can save that for later. 87 // clearTimeout(), we can save that for later.
86 return v8::Undefined(); 88 return v8::Undefined();
87 } 89 }
88 } 90 }
89 91
90 v8::Handle<v8::ObjectTemplate> GlobalJsObject::Create( 92 v8::Handle<v8::ObjectTemplate> GlobalJsObject::Create(
91 ErrorCallback& errorCallback, WebRequest& webRequest) 93 FileSystem& fileSystem, WebRequest& webRequest, ErrorCallback& errorCallback)
92 { 94 {
93 const v8::Locker locker(v8::Isolate::GetCurrent()); 95 const v8::Locker locker(v8::Isolate::GetCurrent());
94 v8::HandleScope handleScope; 96 v8::HandleScope handleScope;
95 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); 97 const v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
96 const v8::Handle<v8::ObjectTemplate> console =
97 AdblockPlus::ConsoleJsObject::Create(errorCallback);
98 global->Set(v8::String::New("console"), console);
99 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction = 98 const v8::Handle<v8::FunctionTemplate> setTimeoutFunction =
100 v8::FunctionTemplate::New(SetTimeoutCallback); 99 v8::FunctionTemplate::New(SetTimeoutCallback);
101 global->Set(v8::String::New("setTimeout"), setTimeoutFunction); 100 global->Set(v8::String::New("setTimeout"), setTimeoutFunction);
102 const v8::Handle<v8::ObjectTemplate> request = 101 const v8::Handle<v8::ObjectTemplate> fileSystemObject =
103 AdblockPlus::WebRequestJsObject::Create(webRequest); 102 FileSystemJsObject::Create(fileSystem);
104 global->Set(v8::String::New("_webRequest"), request); 103 global->Set(v8::String::New("_fileSystem"), fileSystemObject);
104 const v8::Handle<v8::ObjectTemplate> webRequestObject =
105 WebRequestJsObject::Create(webRequest);
106 global->Set(v8::String::New("_webRequest"), webRequestObject);
107 const v8::Handle<v8::ObjectTemplate> consoleObject =
108 ConsoleJsObject::Create(errorCallback);
109 global->Set(v8::String::New("console"), consoleObject);
105 return handleScope.Close(global); 110 return handleScope.Close(global);
106 } 111 }
OLDNEW
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld