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

Unified Diff: content/renderer/bluetooth/bluetooth_dispatcher.h

Issue 1775953004: bluetooth: Move writeValue to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar cleanup Created 4 years, 9 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: content/renderer/bluetooth/bluetooth_dispatcher.h
diff --git a/content/renderer/bluetooth/bluetooth_dispatcher.h b/content/renderer/bluetooth/bluetooth_dispatcher.h
index c93d66fadf3234051ba7eb9d7e4c6522c1263292..57b2f0f416e6179f25346fadb44a7543b8936152 100644
--- a/content/renderer/bluetooth/bluetooth_dispatcher.h
+++ b/content/renderer/bluetooth/bluetooth_dispatcher.h
@@ -14,6 +14,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/common/bluetooth/bluetooth_device.h"
+#include "content/common/bluetooth/bluetooth_service.mojom.h"
#include "content/public/child/worker_thread.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError.h"
@@ -38,6 +39,7 @@ struct BluetoothWriteValueRequest;
struct BluetoothNotificationsRequest;
namespace content {
+class ServiceRegistry;
class ThreadSafeSender;
// Dispatcher for child process threads which communicates to the browser's
@@ -50,13 +52,15 @@ class ThreadSafeSender;
// Outgoing messages come from WebBluetoothImpl.
class BluetoothDispatcher : public WorkerThread::Observer {
public:
- explicit BluetoothDispatcher(ThreadSafeSender* sender);
+ explicit BluetoothDispatcher(ThreadSafeSender* sender,
+ ServiceRegistry* service_registry);
~BluetoothDispatcher() override;
// Gets or Creates a BluetoothDispatcher for the current thread.
// |thread_safe_sender| is required when constructing a BluetoothDispatcher.
static BluetoothDispatcher* GetOrCreateThreadSpecificInstance(
- ThreadSafeSender* thread_safe_sender);
+ ThreadSafeSender* thread_safe_sender,
+ ServiceRegistry* service_registry);
// IPC Send and Receiving interface, see IPC::Sender and IPC::Listener.
bool Send(IPC::Message* msg);
@@ -216,10 +220,10 @@ class BluetoothDispatcher : public WorkerThread::Observer {
void OnReadValueError(int thread_id,
int request_id,
blink::WebBluetoothError error);
- void OnWriteValueSuccess(int thread_id, int request_id);
- void OnWriteValueError(int thread_id,
- int request_id,
- blink::WebBluetoothError error);
+ void OnWriteValue(
+ const blink::WebVector<uint8_t>& value,
+ scoped_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks,
+ blink::mojom::WebBluetoothError error);
void OnStartNotificationsSuccess(int thread_id, int request_id);
void OnStartNotificationsError(int thread_id,
int request_id,
@@ -230,6 +234,8 @@ class BluetoothDispatcher : public WorkerThread::Observer {
const std::string& characteristic_instance_id,
const std::vector<uint8_t> value);
+ mojom::BluetoothServicePtr& GetBluetoothService();
+
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
// Map of characteristic_instance_id to a queue of Notification Requests' IDs.
@@ -257,8 +263,6 @@ class BluetoothDispatcher : public WorkerThread::Observer {
// Tracks requests to read from a characteristics.
IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer>
pending_read_value_requests_;
- IDMap<BluetoothWriteValueRequest, IDMapOwnPointer>
- pending_write_value_requests_;
IDMap<BluetoothNotificationsRequest, IDMapOwnPointer>
pending_notifications_requests_;
@@ -279,6 +283,9 @@ class BluetoothDispatcher : public WorkerThread::Observer {
std::map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*>
active_characteristics_;
+ mojom::BluetoothServicePtr bluetooth_service_;
+
+ ServiceRegistry* service_registry_;
DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
};

Powered by Google App Engine
This is Rietveld 408576698