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

Side by Side Diff: device/hid/hid_connection_win.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to mojo::edk namespace in preparation for runtim flag Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 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 "device/hid/hid_connection_win.h" 5 #include "device/hid/hid_connection_win.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 PendingHidTransfer::~PendingHidTransfer() { 74 PendingHidTransfer::~PendingHidTransfer() {
75 base::MessageLoop::current()->RemoveDestructionObserver(this); 75 base::MessageLoop::current()->RemoveDestructionObserver(this);
76 } 76 }
77 77
78 void PendingHidTransfer::TakeResultFromWindowsAPI(BOOL result) { 78 void PendingHidTransfer::TakeResultFromWindowsAPI(BOOL result) {
79 if (result) { 79 if (result) {
80 callback_.Run(this, true); 80 callback_.Run(this, true);
81 } else if (GetLastError() == ERROR_IO_PENDING) { 81 } else if (GetLastError() == ERROR_IO_PENDING) {
82 base::MessageLoop::current()->AddDestructionObserver(this); 82 base::MessageLoop::current()->AddDestructionObserver(this);
83 AddRef(); 83 AddRef();
84 watcher_.StartWatching(event_.Get(), this); 84 watcher_.StartWatching(event_.Get(), this, false);
85 } else { 85 } else {
86 HID_PLOG(EVENT) << "HID transfer failed"; 86 HID_PLOG(EVENT) << "HID transfer failed";
87 callback_.Run(this, false); 87 callback_.Run(this, false);
88 } 88 }
89 } 89 }
90 90
91 void PendingHidTransfer::OnObjectSignaled(HANDLE event_handle) { 91 void PendingHidTransfer::OnObjectSignaled(HANDLE event_handle) {
92 callback_.Run(this, true); 92 callback_.Run(this, true);
93 Release(); 93 Release();
94 } 94 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (GetOverlappedResult( 248 if (GetOverlappedResult(
249 file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { 249 file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) {
250 callback.Run(true); 250 callback.Run(true);
251 } else { 251 } else {
252 HID_PLOG(EVENT) << "HID write failed"; 252 HID_PLOG(EVENT) << "HID write failed";
253 callback.Run(false); 253 callback.Run(false);
254 } 254 }
255 } 255 }
256 256
257 } // namespace device 257 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698