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

Delta Between Two Patch Sets: src/Notification.cpp

Issue 29361562: Issue 3594 - remove circular references JsEngine-JsValue-JsEngine (Closed)
Left Patch Set: Created Nov. 3, 2016, 11:26 a.m.
Right Patch Set: temporary workaround for race condition Created Dec. 1, 2016, 10:26 a.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
« src/JsValue.cpp ('K') | « src/JsValue.cpp ('k') | src/Thread.cpp » ('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 /* 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 } 64 }
65 65
66 NotificationType Notification::GetType() const 66 NotificationType Notification::GetType() const
67 { 67 {
68 return StringToNotificationType(GetProperty("type")->AsString()); 68 return StringToNotificationType(GetProperty("type")->AsString());
69 } 69 }
70 70
71 NotificationTexts Notification::GetTexts() const 71 NotificationTexts Notification::GetTexts() const
72 { 72 {
73 JsContext context(m_jsEngine); 73 JsContext context(jsEngine);
74 JsValuePtr jsTexts = context.jsEngine().Evaluate("API.getNotificationTexts")-> Call(*this); 74 JsValuePtr jsTexts = context.GetJsEngine().Evaluate("API.getNotificationTexts" )->Call(*this);
75 NotificationTexts notificationTexts; 75 NotificationTexts notificationTexts;
76 JsValuePtr jsTitle = jsTexts->GetProperty("title"); 76 JsValuePtr jsTitle = jsTexts->GetProperty("title");
77 if (jsTitle->IsString()) 77 if (jsTitle->IsString())
78 { 78 {
79 notificationTexts.title = jsTitle->AsString(); 79 notificationTexts.title = jsTitle->AsString();
80 } 80 }
81 JsValuePtr jsMessage = jsTexts->GetProperty("message"); 81 JsValuePtr jsMessage = jsTexts->GetProperty("message");
82 if (jsMessage->IsString()) 82 if (jsMessage->IsString())
83 { 83 {
84 notificationTexts.message = jsMessage->AsString(); 84 notificationTexts.message = jsMessage->AsString();
(...skipping 13 matching lines...) Expand all
98 for (JsValueList::const_iterator linkIterator = urlLinksList.begin(); 98 for (JsValueList::const_iterator linkIterator = urlLinksList.begin();
99 linkIterator != urlLinksList.end(); ++linkIterator) 99 linkIterator != urlLinksList.end(); ++linkIterator)
100 { 100 {
101 retValue.push_back((*linkIterator)->AsString()); 101 retValue.push_back((*linkIterator)->AsString());
102 } 102 }
103 return retValue; 103 return retValue;
104 } 104 }
105 105
106 void Notification::MarkAsShown() 106 void Notification::MarkAsShown()
107 { 107 {
108 JsContext context(m_jsEngine); 108 JsContext context(jsEngine);
109 context.jsEngine().Evaluate("API.markNotificationAsShown")->Call(*GetProperty( "id")); 109 context.GetJsEngine().Evaluate("API.markNotificationAsShown")->Call(*GetProper ty("id"));
110 } 110 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld