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

Unified Diff: src/Notification.cpp

Issue 29361562: Issue 3594 - remove circular references JsEngine-JsValue-JsEngine (Closed)
Patch Set: address comments Created Nov. 29, 2016, 10:45 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/JsValue.cpp ('k') | src/Thread.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/Notification.cpp
diff --git a/src/Notification.cpp b/src/Notification.cpp
index b56fbe2825179b65aededc7d8a19364d3e5db232..0ea895d55be6bddb8d972d93e3272567b9b4f178 100644
--- a/src/Notification.cpp
+++ b/src/Notification.cpp
@@ -17,6 +17,7 @@
#include <AdblockPlus/JsValue.h>
#include <AdblockPlus/JsEngine.h>
+#include "JsContext.h"
#include <AdblockPlus/Notification.h>
#include <algorithm>
@@ -69,7 +70,8 @@ NotificationType Notification::GetType() const
NotificationTexts Notification::GetTexts() const
{
- JsValuePtr jsTexts = jsEngine->Evaluate("API.getNotificationTexts")->Call(*this);
+ JsContext context(jsEngine);
+ JsValuePtr jsTexts = context.GetJsEngine().Evaluate("API.getNotificationTexts")->Call(*this);
NotificationTexts notificationTexts;
JsValuePtr jsTitle = jsTexts->GetProperty("title");
if (jsTitle->IsString())
@@ -103,5 +105,6 @@ std::vector<std::string> Notification::GetLinks() const
void Notification::MarkAsShown()
{
- jsEngine->Evaluate("API.markNotificationAsShown")->Call(*GetProperty("id"));
+ JsContext context(jsEngine);
+ context.GetJsEngine().Evaluate("API.markNotificationAsShown")->Call(*GetProperty("id"));
}
« no previous file with comments | « src/JsValue.cpp ('k') | src/Thread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld