GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / device / hid / hid_connection_win.h
blob5830c21528cb308cfe0e873a67995c7cde68f501
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DEVICE_HID_HID_CONNECTION_WIN_H_
6 #define DEVICE_HID_HID_CONNECTION_WIN_H_
8 #include <windows.h>
10 #include <set>
12 #include "base/win/scoped_handle.h"
13 #include "device/hid/hid_connection.h"
15 namespace device {
17 struct PendingHidTransfer;
19 class HidConnectionWin : public HidConnection {
20 public:
21 HidConnectionWin(scoped_refptr<HidDeviceInfo> device_info,
22 base::win::ScopedHandle file);
24 private:
25 friend class HidServiceWin;
26 friend struct PendingHidTransfer;
28 ~HidConnectionWin();
30 // HidConnection implementation.
31 virtual void PlatformClose() override;
32 virtual void PlatformRead(const ReadCallback& callback) override;
33 virtual void PlatformWrite(scoped_refptr<net::IOBuffer> buffer,
34 size_t size,
35 const WriteCallback& callback) override;
36 virtual void PlatformGetFeatureReport(uint8_t report_id,
37 const ReadCallback& callback) override;
38 virtual void PlatformSendFeatureReport(
39 scoped_refptr<net::IOBuffer> buffer,
40 size_t size,
41 const WriteCallback& callback) override;
43 void OnReadComplete(scoped_refptr<net::IOBuffer> buffer,
44 const ReadCallback& callback,
45 PendingHidTransfer* transfer,
46 bool signaled);
47 void OnReadFeatureComplete(scoped_refptr<net::IOBuffer> buffer,
48 const ReadCallback& callback,
49 PendingHidTransfer* transfer,
50 bool signaled);
51 void OnWriteComplete(const WriteCallback& callback,
52 PendingHidTransfer* transfer,
53 bool signaled);
55 base::win::ScopedHandle file_;
57 std::set<scoped_refptr<PendingHidTransfer> > transfers_;
59 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin);
62 } // namespace device
64 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_