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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBAlternateInterface.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/USBAlternateInterface.h" 5 #include "modules/webusb/USBAlternateInterface.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "modules/webusb/USBEndpoint.h" 8 #include "modules/webusb/USBEndpoint.h"
9 #include "modules/webusb/USBInterface.h" 9 #include "modules/webusb/USBInterface.h"
10 10
(...skipping 15 matching lines...) Expand all
26 return USBAlternateInterface::Create(interface, i); 26 return USBAlternateInterface::Create(interface, i);
27 } 27 }
28 exception_state.ThrowRangeError("Invalid alternate setting."); 28 exception_state.ThrowRangeError("Invalid alternate setting.");
29 return nullptr; 29 return nullptr;
30 } 30 }
31 31
32 USBAlternateInterface::USBAlternateInterface(const USBInterface* interface, 32 USBAlternateInterface::USBAlternateInterface(const USBInterface* interface,
33 size_t alternate_index) 33 size_t alternate_index)
34 : interface_(interface), alternate_index_(alternate_index) { 34 : interface_(interface), alternate_index_(alternate_index) {
35 DCHECK(interface_); 35 DCHECK(interface_);
36 ASSERT(alternate_index_ < interface_->Info().alternates.size()); 36 DCHECK_LT(alternate_index_, interface_->Info().alternates.size());
37 } 37 }
38 38
39 const device::mojom::blink::UsbAlternateInterfaceInfo& 39 const device::mojom::blink::UsbAlternateInterfaceInfo&
40 USBAlternateInterface::Info() const { 40 USBAlternateInterface::Info() const {
41 const device::mojom::blink::UsbInterfaceInfo& interface_info = 41 const device::mojom::blink::UsbInterfaceInfo& interface_info =
42 interface_->Info(); 42 interface_->Info();
43 ASSERT(alternate_index_ < interface_info.alternates.size()); 43 DCHECK_LT(alternate_index_, interface_info.alternates.size());
44 return *interface_info.alternates[alternate_index_]; 44 return *interface_info.alternates[alternate_index_];
45 } 45 }
46 46
47 HeapVector<Member<USBEndpoint>> USBAlternateInterface::endpoints() const { 47 HeapVector<Member<USBEndpoint>> USBAlternateInterface::endpoints() const {
48 HeapVector<Member<USBEndpoint>> endpoints; 48 HeapVector<Member<USBEndpoint>> endpoints;
49 for (size_t i = 0; i < Info().endpoints.size(); ++i) 49 for (size_t i = 0; i < Info().endpoints.size(); ++i)
50 endpoints.push_back(USBEndpoint::Create(this, i)); 50 endpoints.push_back(USBEndpoint::Create(this, i));
51 return endpoints; 51 return endpoints;
52 } 52 }
53 53
54 DEFINE_TRACE(USBAlternateInterface) { 54 DEFINE_TRACE(USBAlternateInterface) {
55 visitor->Trace(interface_); 55 visitor->Trace(interface_);
56 } 56 }
57 57
58 } // namespace blink 58 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698