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

Side by Side Diff: chromeos/dbus/bluetooth_input_client.cc

Issue 11743026: Bluetooth: Increment the timeout for Connect dbus call (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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 | no next file » | 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 #include "chromeos/dbus/bluetooth_input_client.h" 5 #include "chromeos/dbus/bluetooth_input_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "chromeos/dbus/bluetooth_adapter_client.h" 13 #include "chromeos/dbus/bluetooth_adapter_client.h"
14 #include "chromeos/dbus/bluetooth_property.h" 14 #include "chromeos/dbus/bluetooth_property.h"
15 #include "dbus/bus.h" 15 #include "dbus/bus.h"
16 #include "dbus/message.h" 16 #include "dbus/message.h"
17 #include "dbus/object_path.h" 17 #include "dbus/object_path.h"
18 #include "dbus/object_proxy.h" 18 #include "dbus/object_proxy.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
20 20
21 namespace {
22
23 // The |Connect| DBus call needs a longer timeout than the default in order to
24 // give BlueZ enough time to return the timeout error response.
25 // See crosbug.com/37607
26 const int kConnectTimeoutMs = 50 * 1000;
27
28 } // namespace
29
21 namespace chromeos { 30 namespace chromeos {
22 31
23 const char BluetoothInputClient::kNoResponseError[] = 32 const char BluetoothInputClient::kNoResponseError[] =
24 "org.chromium.Error.NoResponse"; 33 "org.chromium.Error.NoResponse";
25 34
26 BluetoothInputClient::Properties::Properties( 35 BluetoothInputClient::Properties::Properties(
27 dbus::ObjectProxy* object_proxy, 36 dbus::ObjectProxy* object_proxy,
28 const PropertyChangedCallback& callback) 37 const PropertyChangedCallback& callback)
29 : BluetoothPropertySet(object_proxy, 38 : BluetoothPropertySet(object_proxy,
30 bluetooth_input::kBluetoothInputInterface, 39 bluetooth_input::kBluetoothInputInterface,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const ConnectCallback& callback, 94 const ConnectCallback& callback,
86 const ConnectErrorCallback& error_callback) OVERRIDE { 95 const ConnectErrorCallback& error_callback) OVERRIDE {
87 dbus::MethodCall method_call( 96 dbus::MethodCall method_call(
88 bluetooth_input::kBluetoothInputInterface, 97 bluetooth_input::kBluetoothInputInterface,
89 bluetooth_input::kConnect); 98 bluetooth_input::kConnect);
90 99
91 dbus::ObjectProxy* object_proxy = GetObjectProxy(object_path); 100 dbus::ObjectProxy* object_proxy = GetObjectProxy(object_path);
92 101
93 object_proxy->CallMethodWithErrorCallback( 102 object_proxy->CallMethodWithErrorCallback(
94 &method_call, 103 &method_call,
95 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 104 kConnectTimeoutMs,
96 base::Bind(&BluetoothInputClientImpl::OnConnect, 105 base::Bind(&BluetoothInputClientImpl::OnConnect,
97 weak_ptr_factory_.GetWeakPtr(), object_path, 106 weak_ptr_factory_.GetWeakPtr(), object_path,
98 callback), 107 callback),
99 base::Bind(&BluetoothInputClientImpl::OnConnectError, 108 base::Bind(&BluetoothInputClientImpl::OnConnectError,
100 weak_ptr_factory_.GetWeakPtr(), object_path, 109 weak_ptr_factory_.GetWeakPtr(), object_path,
101 error_callback)); 110 error_callback));
102 } 111 }
103 112
104 // BluetoothInputClient override. 113 // BluetoothInputClient override.
105 virtual void Disconnect(const dbus::ObjectPath& object_path, 114 virtual void Disconnect(const dbus::ObjectPath& object_path,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 DBusClientImplementationType type, 294 DBusClientImplementationType type,
286 dbus::Bus* bus, 295 dbus::Bus* bus,
287 BluetoothAdapterClient* adapter_client) { 296 BluetoothAdapterClient* adapter_client) {
288 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 297 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
289 return new BluetoothInputClientImpl(bus, adapter_client); 298 return new BluetoothInputClientImpl(bus, adapter_client);
290 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 299 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
291 return new BluetoothInputClientStubImpl(); 300 return new BluetoothInputClientStubImpl();
292 } 301 }
293 302
294 } // namespace chromeos 303 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698