Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: dbus/property.h

Issue 1361503003: libchrome: add support for synchronous PropertySet::Set to dbus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dbus/property.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DBUS_PROPERTY_H_ 5 #ifndef DBUS_PROPERTY_H_
6 #define DBUS_PROPERTY_H_ 6 #define DBUS_PROPERTY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Callback for Set() method, |success| indicates whether or not the 269 // Callback for Set() method, |success| indicates whether or not the
270 // new property value was accepted by the remote object. 270 // new property value was accepted by the remote object.
271 typedef base::Callback<void(bool success)> SetCallback; 271 typedef base::Callback<void(bool success)> SetCallback;
272 272
273 // Requests that the remote object for |property| change the property to 273 // Requests that the remote object for |property| change the property to
274 // its new value. |callback| will be called to indicate the success or 274 // its new value. |callback| will be called to indicate the success or
275 // failure of the request, however the new value may not be available 275 // failure of the request, however the new value may not be available
276 // depending on the remote object. This method may be overridden by 276 // depending on the remote object. This method may be overridden by
277 // sub-classes if interfaces use different method calls. 277 // sub-classes if interfaces use different method calls.
278 virtual void Set(PropertyBase* property, SetCallback callback); 278 virtual void Set(PropertyBase* property, SetCallback callback);
279 // The sychronous version of Set().
280 virtual bool SetAndBlock(PropertyBase* property);
279 virtual void OnSet(PropertyBase* property, SetCallback callback, 281 virtual void OnSet(PropertyBase* property, SetCallback callback,
280 Response* response); 282 Response* response);
281 283
282 // Update properties by reading an array of dictionary entries, each 284 // Update properties by reading an array of dictionary entries, each
283 // containing a string with the name and a variant with the value, from 285 // containing a string with the name and a variant with the value, from
284 // |message_reader|. Returns false if message is in incorrect format. 286 // |message_reader|. Returns false if message is in incorrect format.
285 bool UpdatePropertiesFromReader(MessageReader* reader); 287 bool UpdatePropertiesFromReader(MessageReader* reader);
286 288
287 // Updates a single property by reading a string with the name and a 289 // Updates a single property by reading a string with the name and a
288 // variant with the value from |message_reader|. Returns false if message 290 // variant with the value from |message_reader|. Returns false if message
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 384
383 // Requests that the remote object change the property value to |value|, 385 // Requests that the remote object change the property value to |value|,
384 // |callback| will be called to indicate the success or failure of the 386 // |callback| will be called to indicate the success or failure of the
385 // request, however the new value may not be available depending on the 387 // request, however the new value may not be available depending on the
386 // remote object. 388 // remote object.
387 virtual void Set(const T& value, dbus::PropertySet::SetCallback callback) { 389 virtual void Set(const T& value, dbus::PropertySet::SetCallback callback) {
388 set_value_ = value; 390 set_value_ = value;
389 property_set()->Set(this, callback); 391 property_set()->Set(this, callback);
390 } 392 }
391 393
394 // The sychronous version of Set().
395 virtual bool SetAndBlock(const T& value) {
396 set_value_ = value;
397 return property_set()->SetAndBlock(this);
398 }
399
392 // Method used by PropertySet to retrieve the value from a MessageReader, 400 // Method used by PropertySet to retrieve the value from a MessageReader,
393 // no knowledge of the contained type is required, this method returns 401 // no knowledge of the contained type is required, this method returns
394 // true if its expected type was found, false if not. 402 // true if its expected type was found, false if not.
395 bool PopValueFromReader(MessageReader* reader) override; 403 bool PopValueFromReader(MessageReader* reader) override;
396 404
397 // Method used by PropertySet to append the set value to a MessageWriter, 405 // Method used by PropertySet to append the set value to a MessageWriter,
398 // no knowledge of the contained type is required. 406 // no knowledge of the contained type is required.
399 // Implementation provided by specialization. 407 // Implementation provided by specialization.
400 void AppendSetValueToWriter(MessageWriter* writer) override; 408 void AppendSetValueToWriter(MessageWriter* writer) override;
401 409
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>:: 593 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
586 AppendSetValueToWriter(MessageWriter* writer); 594 AppendSetValueToWriter(MessageWriter* writer);
587 extern template class CHROME_DBUS_EXPORT 595 extern template class CHROME_DBUS_EXPORT
588 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>; 596 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
589 597
590 #pragma GCC diagnostic pop 598 #pragma GCC diagnostic pop
591 599
592 } // namespace dbus 600 } // namespace dbus
593 601
594 #endif // DBUS_PROPERTY_H_ 602 #endif // DBUS_PROPERTY_H_
OLDNEW
« no previous file with comments | « no previous file | dbus/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698