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

Unified Diff: device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc

Issue 1920693002: Complete //device/bt implementation for hosting local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
index 686a1a5f0709d2a9cdc0197af505b1556bbf8e53..89722441d5fdc9d9d5f4b77350e8d66b1337569b 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
@@ -4,17 +4,13 @@
#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
-#include <memory>
-#include <utility>
-
#include "base/bind.h"
+#include "base/callback.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/platform_thread.h"
#include "dbus/exported_object.h"
-#include "dbus/message.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -192,11 +188,16 @@ class BluetoothGattServiceServiceProviderImpl
std::unique_ptr<dbus::Response> response =
dbus::Response::FromMethodCall(method_call);
dbus::MessageWriter writer(response.get());
+ WriteProperties(&writer);
+ response_sender.Run(std::move(response));
+ }
+
+ void WriteProperties(dbus::MessageWriter* writer) override {
dbus::MessageWriter array_writer(NULL);
dbus::MessageWriter dict_entry_writer(NULL);
dbus::MessageWriter variant_writer(NULL);
- writer.OpenArray("{sv}", &array_writer);
+ writer->OpenArray("{sv}", &array_writer);
array_writer.OpenDictEntry(&dict_entry_writer);
dict_entry_writer.AppendString(bluetooth_gatt_service::kUUIDProperty);
@@ -210,9 +211,7 @@ class BluetoothGattServiceServiceProviderImpl
dict_entry_writer.CloseContainer(&variant_writer);
array_writer.CloseContainer(&dict_entry_writer);
- writer.CloseContainer(&array_writer);
-
- response_sender.Run(std::move(response));
+ writer->CloseContainer(&array_writer);
}
// Called by dbus:: when a method is exported.
@@ -223,6 +222,8 @@ class BluetoothGattServiceServiceProviderImpl
<< method_name;
}
+ const dbus::ObjectPath& object_path() const override { return object_path_; }
+
// Origin thread (i.e. the UI thread in production).
base::PlatformThreadId origin_thread_id_;

Powered by Google App Engine
This is Rietveld 408576698