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

Delta Between Two Patch Sets: src/JsEngine.cpp

Issue 10296001: Implement File API (Closed)
Left Patch Set: Created April 12, 2013, 10:10 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/GlobalJsObject.cpp ('k') | src/Utils.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <sstream> 2 #include <sstream>
3 3
4 #include "GlobalJsObject.h" 4 #include "GlobalJsObject.h"
5 #include "Utils.h" 5 #include "Utils.h"
6 6
7 namespace 7 namespace
8 { 8 {
9 v8::Handle<v8::Context> CreateContext( 9 v8::Handle<v8::Context> CreateContext(
10 AdblockPlus::FileSystem& fileSystem, 10 AdblockPlus::FileSystem& fileSystem,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const v8::Handle<v8::Script> script = CompileScript(source, filename); 77 const v8::Handle<v8::Script> script = CompileScript(source, filename);
78 CheckTryCatch(tryCatch); 78 CheckTryCatch(tryCatch);
79 v8::Local<v8::Value> result = script->Run(); 79 v8::Local<v8::Value> result = script->Run();
80 CheckTryCatch(tryCatch); 80 CheckTryCatch(tryCatch);
81 v8::String::Utf8Value resultString(result); 81 v8::String::Utf8Value resultString(result);
82 return std::string(*resultString); 82 return std::string(*resultString);
83 } 83 }
84 84
85 void AdblockPlus::JsEngine::Load(const std::string& scriptPath) 85 void AdblockPlus::JsEngine::Load(const std::string& scriptPath)
86 { 86 {
87 const std::auto_ptr<std::istream> file = fileSystem->Read(scriptPath); 87 const std::tr1::shared_ptr<std::istream> file = fileSystem->Read(scriptPath);
88 if (!file.get() || !*file) 88 if (!file || !*file)
89 throw std::runtime_error("Unable to load script " + scriptPath); 89 throw std::runtime_error("Unable to load script " + scriptPath);
90 Evaluate(Utils::Slurp(*file)); 90 Evaluate(Utils::Slurp(*file));
91 } 91 }
92 92
93 void AdblockPlus::JsEngine::Gc() 93 void AdblockPlus::JsEngine::Gc()
94 { 94 {
95 while (!v8::V8::IdleNotification()); 95 while (!v8::V8::IdleNotification());
96 } 96 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld