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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBEndpoint.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/USBEndpoint.h" 5 #include "modules/webusb/USBEndpoint.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "device/usb/public/interfaces/device.mojom-blink.h" 9 #include "device/usb/public/interfaces/device.mojom-blink.h"
10 #include "modules/webusb/USBAlternateInterface.h" 10 #include "modules/webusb/USBAlternateInterface.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 exception_state.ThrowRangeError( 66 exception_state.ThrowRangeError(
67 "No such endpoint exists in the given alternate interface."); 67 "No such endpoint exists in the given alternate interface.");
68 return nullptr; 68 return nullptr;
69 } 69 }
70 70
71 USBEndpoint::USBEndpoint(const USBAlternateInterface* alternate, 71 USBEndpoint::USBEndpoint(const USBAlternateInterface* alternate,
72 size_t endpoint_index) 72 size_t endpoint_index)
73 : alternate_(alternate), endpoint_index_(endpoint_index) { 73 : alternate_(alternate), endpoint_index_(endpoint_index) {
74 DCHECK(alternate_); 74 DCHECK(alternate_);
75 ASSERT(endpoint_index_ < alternate_->Info().endpoints.size()); 75 DCHECK_LT(endpoint_index_, alternate_->Info().endpoints.size());
76 } 76 }
77 77
78 const device::mojom::blink::UsbEndpointInfo& USBEndpoint::Info() const { 78 const device::mojom::blink::UsbEndpointInfo& USBEndpoint::Info() const {
79 const device::mojom::blink::UsbAlternateInterfaceInfo& alternate_info = 79 const device::mojom::blink::UsbAlternateInterfaceInfo& alternate_info =
80 alternate_->Info(); 80 alternate_->Info();
81 ASSERT(endpoint_index_ < alternate_info.endpoints.size()); 81 DCHECK_LT(endpoint_index_, alternate_info.endpoints.size());
82 return *alternate_info.endpoints[endpoint_index_]; 82 return *alternate_info.endpoints[endpoint_index_];
83 } 83 }
84 84
85 String USBEndpoint::direction() const { 85 String USBEndpoint::direction() const {
86 return ConvertDirectionToEnum(Info().direction); 86 return ConvertDirectionToEnum(Info().direction);
87 } 87 }
88 88
89 String USBEndpoint::type() const { 89 String USBEndpoint::type() const {
90 return ConvertTypeToEnum(Info().type); 90 return ConvertTypeToEnum(Info().type);
91 } 91 }
92 92
93 DEFINE_TRACE(USBEndpoint) { 93 DEFINE_TRACE(USBEndpoint) {
94 visitor->Trace(alternate_); 94 visitor->Trace(alternate_);
95 } 95 }
96 96
97 } // namespace blink 97 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBDevice.cpp ('k') | third_party/WebKit/Source/modules/webusb/USBInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698