| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 AdblockPlus::JsEngine::EventCallback callback) | 77 AdblockPlus::JsEngine::EventCallback callback) |
| 78 { | 78 { |
| 79 eventCallbacks[eventName] = callback; | 79 eventCallbacks[eventName] = callback; |
| 80 } | 80 } |
| 81 | 81 |
| 82 void AdblockPlus::JsEngine::RemoveEventCallback(const std::string& eventName) | 82 void AdblockPlus::JsEngine::RemoveEventCallback(const std::string& eventName) |
| 83 { | 83 { |
| 84 eventCallbacks.erase(eventName); | 84 eventCallbacks.erase(eventName); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void AdblockPlus::JsEngine::TriggerEvent(const std::string& eventName) | 87 void AdblockPlus::JsEngine::TriggerEvent(const std::string& eventName, AdblockPl
us::JsValueList& params) |
| 88 { | 88 { |
| 89 EventMap::iterator it = eventCallbacks.find(eventName); | 89 EventMap::iterator it = eventCallbacks.find(eventName); |
| 90 if (it != eventCallbacks.end()) | 90 if (it != eventCallbacks.end()) |
| 91 it->second(); | 91 it->second(params); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void AdblockPlus::JsEngine::Gc() | 94 void AdblockPlus::JsEngine::Gc() |
| 95 { | 95 { |
| 96 while (!v8::V8::IdleNotification()); | 96 while (!v8::V8::IdleNotification()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewValue(const std::string& val) | 99 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewValue(const std::string& val) |
| 100 { | 100 { |
| 101 const JsContext context(shared_from_this()); | 101 const JsContext context(shared_from_this()); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return logSystem; | 193 return logSystem; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val) | 196 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val) |
| 197 { | 197 { |
| 198 if (!val) | 198 if (!val) |
| 199 throw std::runtime_error("LogSystem cannot be null"); | 199 throw std::runtime_error("LogSystem cannot be null"); |
| 200 | 200 |
| 201 logSystem = val; | 201 logSystem = val; |
| 202 } | 202 } |
| OLD | NEW |