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

Side by Side Diff: src/JsEngine.cpp

Issue 29394612: Issue 5035 - Fix build on gcc 4.8 (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created March 24, 2017, 9:10 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 | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 auto timerTaskInfoIterator = timerTaskInfos.emplace(timerTaskInfos.end()); 95 auto timerTaskInfoIterator = timerTaskInfos.emplace(timerTaskInfos.end());
96 timerTaskInfoIterator->delay = arguments[1]->IntegerValue(); 96 timerTaskInfoIterator->delay = arguments[1]->IntegerValue();
97 97
98 for (int i = 0; i < arguments.Length(); i++) 98 for (int i = 0; i < arguments.Length(); i++)
99 timerTaskInfoIterator->arguments.emplace_back(new v8::Persistent<v8::Value>( GetIsolate(), arguments[i])); 99 timerTaskInfoIterator->arguments.emplace_back(new v8::Persistent<v8::Value>( GetIsolate(), arguments[i]));
100 TimerTask retValue = { shared_from_this(), timerTaskInfoIterator }; 100 TimerTask retValue = { shared_from_this(), timerTaskInfoIterator };
101 return retValue; 101 return retValue;
102 } 102 }
103 103
104 void JsEngine::CallTimerTask(TimerTaskInfos::const_iterator timerTaskInfoIterato r) 104 void JsEngine::CallTimerTask(TimerTaskInfos::iterator timerTaskInfoIterator)
105 { 105 {
106 const JsContext context(shared_from_this()); 106 const JsContext context(shared_from_this());
107 JsValue callback(shared_from_this(), v8::Local<v8::Value>::New(GetIsolate(), * timerTaskInfoIterator->arguments[0])); 107 JsValue callback(shared_from_this(), v8::Local<v8::Value>::New(GetIsolate(), * timerTaskInfoIterator->arguments[0]));
108 JsConstValueList callbackArgs; 108 JsConstValueList callbackArgs;
109 for (int i = 2; i < timerTaskInfoIterator->arguments.size(); i++) 109 for (int i = 2; i < timerTaskInfoIterator->arguments.size(); i++)
110 callbackArgs.emplace_back(new JsValue(shared_from_this(), 110 callbackArgs.emplace_back(new JsValue(shared_from_this(),
111 v8::Local<v8::Value>::New(GetIsolate(), *timerTaskInfoIterator->arguments[i] ))); 111 v8::Local<v8::Value>::New(GetIsolate(), *timerTaskInfoIterator->arguments[i] )));
112 callback.Call(callbackArgs); 112 callback.Call(callbackArgs);
113 timerTaskInfos.erase(timerTaskInfoIterator); 113 timerTaskInfos.erase(timerTaskInfoIterator);
114 } 114 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 316
317 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, 317 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
318 AdblockPlus::JsValuePtr value) 318 AdblockPlus::JsValuePtr value)
319 { 319 {
320 auto global = GetGlobalObject(); 320 auto global = GetGlobalObject();
321 if (!global) 321 if (!global)
322 throw std::runtime_error("Global object cannot be null"); 322 throw std::runtime_error("Global object cannot be null");
323 global->SetProperty(name, value); 323 global->SetProperty(name, value);
324 } 324 }
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld