Merge lp:~marcustomlinson/unity-scopes-api/lp-1356699 into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Pete Woods
Approved revision: 515
Merged at revision: 512
Proposed branch: lp:~marcustomlinson/unity-scopes-api/lp-1356699
Merge into: lp:unity-scopes-api/devel
Diff against target: 186 lines (+52/-8)
8 files modified
CMakeLists.txt (+1/-1)
RELEASE_NOTES.md (+4/-0)
debian/changelog (+6/-0)
debian/libunity-scopes3.symbols (+2/-1)
include/unity/scopes/internal/RegistryObject.h (+4/-0)
include/unity/scopes/internal/smartscopes/SSRegistryObject.h (+1/-0)
src/scopes/internal/RegistryObject.cpp (+18/-0)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+16/-6)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/lp-1356699
Reviewer Review Type Date Requested Status
Pete Woods (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+239216@code.launchpad.net

Commit message

Replace "InvalidateResults" dbus-send with "list updated" pub/sub mechanism to invalidate smart scopes

To post a comment you must log in.
513. By Marcus Tomlinson

Bumped version

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
514. By Marcus Tomlinson

Updated symbols

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
515. By Marcus Tomlinson

Removed "arch=amd64" from symbols

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Pete Woods (pete-woods) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-10-09 06:01:15 +0000
3+++ CMakeLists.txt 2014-10-22 19:42:33 +0000
4@@ -195,7 +195,7 @@
5 # API version
6 set(UNITY_SCOPES_MAJOR 0)
7 set(UNITY_SCOPES_MINOR 6)
8-set(UNITY_SCOPES_MICRO 7)
9+set(UNITY_SCOPES_MICRO 8)
10 set(UNITY_SCOPES_SOVERSION 3)
11
12 # Version for testing, with all symbols visible
13
14=== modified file 'RELEASE_NOTES.md'
15--- RELEASE_NOTES.md 2014-10-10 17:07:01 +0000
16+++ RELEASE_NOTES.md 2014-10-22 19:42:33 +0000
17@@ -1,6 +1,10 @@
18 Release notes
19 =============
20
21+Changes in version 0.6.8
22+========================
23+ - Replaced dbus-send with "list updated" pub/sub to invalidate smart scopes.
24+
25 Changes in version 0.6.7
26 ========================
27 - OnlineAccountClient fixes: run the internal event loop within its own context to avoid
28
29=== modified file 'debian/changelog'
30--- debian/changelog 2014-10-10 19:24:20 +0000
31+++ debian/changelog 2014-10-22 19:42:33 +0000
32@@ -1,3 +1,9 @@
33+unity-scopes-api (0.6.8-0ubuntu1) UNRELEASED; urgency=medium
34+
35+ * Replaced dbus-send with "list updated" pub/sub to invalidate smart scopes.
36+
37+ -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 22 Oct 2014 17:44:46 +0200
38+
39 unity-scopes-api (0.6.7+14.10.20141010.1-0ubuntu1) utopic; urgency=medium
40
41 [ Marcus Tomlinson ]
42
43=== modified file 'debian/libunity-scopes3.symbols'
44--- debian/libunity-scopes3.symbols 2014-10-10 07:42:13 +0000
45+++ debian/libunity-scopes3.symbols 2014-10-22 19:42:33 +0000
46@@ -377,7 +377,7 @@
47 (c++)"unity::scopes::internal::RegistryObject::remove_desktop_file(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.6.6+14.10.20140916
48 (c++)"unity::scopes::internal::RegistryObject::remove_local_scope(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
49 (c++)"unity::scopes::internal::RegistryObject::ScopeExecData::~ScopeExecData()@Base" 0.4.2+14.04.20140404.2
50- (c++|arch=amd64)"unity::scopes::internal::RegistryObject::ScopeExecData::ScopeExecData(unity::scopes::internal::RegistryObject::ScopeExecData const&)@Base" 0.6.6+14.10.20140916
51+ (c++)"unity::scopes::internal::RegistryObject::ScopeExecData::ScopeExecData(unity::scopes::internal::RegistryObject::ScopeExecData const&)@Base" 0.6.6+14.10.20140916
52 (c++)"unity::scopes::internal::RegistryObject::ScopeProcess::clear_handle_unlocked()@Base" 0.4.2+14.04.20140404.2
53 (c++)"unity::scopes::internal::RegistryObject::ScopeProcess::exec(core::posix::ChildProcess::DeathObserver&, std::shared_ptr<unity::scopes::internal::Executor>)@Base" 0.4.3+14.10.20140428
54 (c++)"unity::scopes::internal::RegistryObject::ScopeProcess::expand_custom_exec()@Base" 0.5.0+14.10.20140619
55@@ -394,6 +394,7 @@
56 (c++)"unity::scopes::internal::RegistryObject::ScopeProcess::wait_for_state(std::unique_lock<std::mutex>&, unity::scopes::internal::RegistryObject::ScopeProcess::ProcessState) const@Base" 0.4.5+14.10.20140513
57 (c++)"unity::scopes::internal::RegistryObject::ScopeProcess::wait_for_state(unity::scopes::internal::RegistryObject::ScopeProcess::ProcessState) const@Base" 0.4.5+14.10.20140513
58 (c++)"unity::scopes::internal::RegistryObject::set_remote_registry(std::shared_ptr<unity::scopes::internal::MWRegistry> const&)@Base" 0.4.0+14.04.20140312.1
59+ (c++)"unity::scopes::internal::RegistryObject::ss_list_update()@Base" 0replaceme
60 (c++)"unity::scopes::internal::RegistryObject::state_receiver()@Base" 0.4.2+14.04.20140404.2
61 (c++)"unity::scopes::internal::RuntimeConfig::config_directory() const@Base" 0.6.2+rtm+rtm+rtm+14.09.20140818
62 (c++)"unity::scopes::internal::RuntimeConfig::data_directory() const@Base" 0.5.2+14.10.20140709.2
63
64=== modified file 'include/unity/scopes/internal/RegistryObject.h'
65--- include/unity/scopes/internal/RegistryObject.h 2014-09-15 14:15:10 +0000
66+++ include/unity/scopes/internal/RegistryObject.h 2014-10-22 19:42:33 +0000
67@@ -85,6 +85,8 @@
68 void create_desktop_file(ScopeMetadata const& metadata);
69 void remove_desktop_file(std::string const& scope_id);
70
71+ void ss_list_update();
72+
73 class ScopeProcess
74 {
75 public:
76@@ -144,6 +146,8 @@
77 mutable std::mutex mutex_;
78
79 MWPublisher::SPtr publisher_;
80+ MWSubscriber::SPtr ss_list_update_subscriber_;
81+ std::shared_ptr<core::ScopedConnection> ss_list_update_connection_;
82 bool generate_desktop_files_;
83 };
84
85
86=== modified file 'include/unity/scopes/internal/smartscopes/SSRegistryObject.h'
87--- include/unity/scopes/internal/smartscopes/SSRegistryObject.h 2014-08-20 07:58:15 +0000
88+++ include/unity/scopes/internal/smartscopes/SSRegistryObject.h 2014-10-22 19:42:33 +0000
89@@ -98,6 +98,7 @@
90
91 bool caching_enabled_;
92 std::string locale_;
93+ MWPublisher::SPtr publisher_;
94 };
95
96 } // namespace smartscopes
97
98=== modified file 'src/scopes/internal/RegistryObject.cpp'
99--- src/scopes/internal/RegistryObject.cpp 2014-10-06 08:17:09 +0000
100+++ src/scopes/internal/RegistryObject.cpp 2014-10-22 19:42:33 +0000
101@@ -78,6 +78,15 @@
102 try
103 {
104 publisher_ = middleware->create_publisher(middleware->runtime()->registry_identity());
105+
106+ ss_list_update_subscriber_ = middleware->create_subscriber(middleware->runtime()->ss_registry_identity());
107+ ss_list_update_connection_ = std::make_shared<core::ScopedConnection>
108+ (
109+ ss_list_update_subscriber_->message_received().connect([this](string const&)
110+ {
111+ ss_list_update();
112+ })
113+ );
114 }
115 catch (std::exception const& e)
116 {
117@@ -415,6 +424,15 @@
118 }
119 }
120
121+void RegistryObject::ss_list_update()
122+{
123+ if (publisher_)
124+ {
125+ // Send a blank message to subscribers to inform them that the samrt scopes proxy has been updated
126+ publisher_->send_message("");
127+ }
128+}
129+
130 RegistryObject::ScopeProcess::ScopeProcess(ScopeExecData exec_data, std::weak_ptr<MWPublisher> const& publisher)
131 : exec_data_(exec_data)
132 , reg_publisher_(publisher)
133
134=== modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp'
135--- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-08-26 04:00:56 +0000
136+++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-10-22 19:42:33 +0000
137@@ -22,6 +22,7 @@
138 #include <unity/scopes/internal/JsonSettingsSchema.h>
139 #include <unity/scopes/internal/RegistryException.h>
140 #include <unity/scopes/internal/RuntimeConfig.h>
141+#include <unity/scopes/internal/RuntimeImpl.h>
142 #include <unity/scopes/internal/ScopeImpl.h>
143 #include <unity/scopes/internal/ScopeMetadataImpl.h>
144 #include <unity/scopes/internal/smartscopes/HttpClientQt.h>
145@@ -31,8 +32,6 @@
146
147 #include <iostream>
148
149-static const char* c_dbussend_cmd = "dbus-send /com/canonical/unity/scopes com.canonical.unity.scopes.InvalidateResults string:smart-scopes";
150-
151 namespace unity
152 {
153
154@@ -86,6 +85,18 @@
155 }
156
157 refresh_thread_ = std::thread(&SSRegistryObject::refresh_thread, this);
158+
159+ if (middleware)
160+ {
161+ try
162+ {
163+ publisher_ = middleware->create_publisher(middleware->runtime()->ss_registry_identity());
164+ }
165+ catch (std::exception const& e)
166+ {
167+ std::cerr << "SSRegistryObject(): failed to create registry publisher: " << e.what() << std::endl;
168+ }
169+ }
170 }
171
172 SSRegistryObject::~SSRegistryObject()
173@@ -372,11 +383,10 @@
174 scopes_ = new_scopes_;
175 }
176
177- if (changed)
178+ if (changed && publisher_)
179 {
180- // something has changed, send invalidate signal
181- int result = safe_system_call(c_dbussend_cmd);
182- (void)result;
183+ // Send a blank message to subscribers to inform them that the smart scopes registry has been updated
184+ publisher_->send_message("");
185 }
186 }
187

Subscribers

People subscribed via source and target branches

to all changes: