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

Side by Side Diff: extensions/browser/api/usb/usb_api.cc

Issue 881363004: Remove extra call to UsbDeviceHandle::Close in chrome.usb.closeDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | extensions/browser/api/usb/usb_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 "extensions/browser/api/usb/usb_api.h" 5 #include "extensions/browser/api/usb/usb_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 EXTENSION_FUNCTION_VALIDATE(parameters_.get()); 933 EXTENSION_FUNCTION_VALIDATE(parameters_.get());
934 return true; 934 return true;
935 } 935 }
936 936
937 void UsbCloseDeviceFunction::AsyncWorkStart() { 937 void UsbCloseDeviceFunction::AsyncWorkStart() {
938 scoped_refptr<UsbDeviceHandle> device_handle = 938 scoped_refptr<UsbDeviceHandle> device_handle =
939 GetDeviceHandleOrCompleteWithError(parameters_->handle); 939 GetDeviceHandleOrCompleteWithError(parameters_->handle);
940 if (!device_handle.get()) 940 if (!device_handle.get())
941 return; 941 return;
942 942
943 device_handle->Close(); 943 // The device handle is closed when the resource is destroyed.
944 RemoveUsbDeviceResource(parameters_->handle.handle); 944 RemoveUsbDeviceResource(parameters_->handle.handle);
945 AsyncWorkCompleted(); 945 AsyncWorkCompleted();
946 } 946 }
947 947
948 UsbClaimInterfaceFunction::UsbClaimInterfaceFunction() { 948 UsbClaimInterfaceFunction::UsbClaimInterfaceFunction() {
949 } 949 }
950 950
951 UsbClaimInterfaceFunction::~UsbClaimInterfaceFunction() { 951 UsbClaimInterfaceFunction::~UsbClaimInterfaceFunction() {
952 } 952 }
953 953
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 SetResult(new base::FundamentalValue(false)); 1269 SetResult(new base::FundamentalValue(false));
1270 CompleteWithError(kErrorResetDevice); 1270 CompleteWithError(kErrorResetDevice);
1271 return; 1271 return;
1272 } 1272 }
1273 1273
1274 SetResult(new base::FundamentalValue(true)); 1274 SetResult(new base::FundamentalValue(true));
1275 AsyncWorkCompleted(); 1275 AsyncWorkCompleted();
1276 } 1276 }
1277 1277
1278 } // namespace extensions 1278 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/usb/usb_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698