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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBInterface.cpp

Issue 2879773002: Replace remaining ASSERT with DCHECK|DCHECK_FOO in modules (Closed)
Patch Set: Replace remaining ASSERT with DCHECK|DCHECK_FOO in modules Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/webusb/USBInterface.h" 5 #include "modules/webusb/USBInterface.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "device/usb/public/interfaces/device.mojom-blink.h" 8 #include "device/usb/public/interfaces/device.mojom-blink.h"
9 #include "modules/webusb/USBAlternateInterface.h" 9 #include "modules/webusb/USBAlternateInterface.h"
10 #include "modules/webusb/USBConfiguration.h" 10 #include "modules/webusb/USBConfiguration.h"
(...skipping 19 matching lines...) Expand all
30 exception_state.ThrowRangeError("Invalid interface index."); 30 exception_state.ThrowRangeError("Invalid interface index.");
31 return nullptr; 31 return nullptr;
32 } 32 }
33 33
34 USBInterface::USBInterface(const USBDevice* device, 34 USBInterface::USBInterface(const USBDevice* device,
35 size_t configuration_index, 35 size_t configuration_index,
36 size_t interface_index) 36 size_t interface_index)
37 : device_(device), 37 : device_(device),
38 configuration_index_(configuration_index), 38 configuration_index_(configuration_index),
39 interface_index_(interface_index) { 39 interface_index_(interface_index) {
40 ASSERT(configuration_index_ < device_->Info().configurations.size()); 40 DCHECK_LT(configuration_index_, device_->Info().configurations.size());
41 ASSERT( 41 DCHECK_LT(
42 interface_index_ < 42 interface_index_,
43 device_->Info().configurations[configuration_index_]->interfaces.size()); 43 device_->Info().configurations[configuration_index_]->interfaces.size());
44 } 44 }
45 45
46 const device::mojom::blink::UsbInterfaceInfo& USBInterface::Info() const { 46 const device::mojom::blink::UsbInterfaceInfo& USBInterface::Info() const {
47 return *device_->Info() 47 return *device_->Info()
48 .configurations[configuration_index_] 48 .configurations[configuration_index_]
49 ->interfaces[interface_index_]; 49 ->interfaces[interface_index_];
50 } 50 }
51 51
52 USBAlternateInterface* USBInterface::alternate() const { 52 USBAlternateInterface* USBInterface::alternate() const {
(...skipping 12 matching lines...) Expand all
65 65
66 bool USBInterface::claimed() const { 66 bool USBInterface::claimed() const {
67 return device_->IsInterfaceClaimed(configuration_index_, interface_index_); 67 return device_->IsInterfaceClaimed(configuration_index_, interface_index_);
68 } 68 }
69 69
70 DEFINE_TRACE(USBInterface) { 70 DEFINE_TRACE(USBInterface) {
71 visitor->Trace(device_); 71 visitor->Trace(device_);
72 } 72 }
73 73
74 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698