From 141d025104c98b1fb690ec626aa43aad80552a3a Mon Sep 17 00:00:00 2001 From: Avi Drissman Date: Tue, 25 Dec 2018 20:28:54 +0000 Subject: [PATCH] Use base::size rather than arraysize in device/. This is purely a mechanical change; there is no intended behavior change. BUG=837308 TBR=rockot@google.com Change-Id: If4b83253ade42613e9683b69e187b79a2a940b98 Reviewed-on: https://chromium-review.googlesource.com/c/1390730 Reviewed-by: Avi Drissman Commit-Queue: Avi Drissman Cr-Commit-Position: refs/heads/master@{#618878} --- device/bluetooth/bluetooth_device_unittest.cc | 5 ++--- device/bluetooth/bluetooth_gatt_descriptor.cc | 3 ++- ...bluetooth_remote_gatt_characteristic_unittest.cc | 8 ++++---- .../bluetooth_remote_gatt_descriptor_unittest.cc | 11 ++++++----- device/bluetooth/bluetooth_uuid_unittest.cc | 4 ++-- .../dbus/fake_bluetooth_media_transport_client.cc | 6 +++--- device/bluetooth/uribeacon/uri_encoder.cc | 10 +++++----- device/fido/ctap_response_unittest.cc | 3 ++- .../gamepad/gamepad_platform_data_fetcher_linux.cc | 5 +++-- device/gamepad/raw_input_data_fetcher_win.cc | 8 ++++---- device/gamepad/xbox_data_fetcher_mac.cc | 7 ++++--- device/test/usb_test_gadget_impl.cc | 6 +++--- device/vr/openvr/test/fake_openvr_impl_api.cc | 13 +++++++------ device/vr/windows/d3d11_texture_helper.cc | 6 ++++-- 14 files changed, 51 insertions(+), 44 deletions(-) diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc index b6811322f9424d..5a21ab6271d975 100644 --- a/device/bluetooth/bluetooth_device_unittest.cc +++ b/device/bluetooth/bluetooth_device_unittest.cc @@ -6,7 +6,6 @@ #include -#include "base/macros.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" @@ -65,7 +64,7 @@ TEST(BluetoothDeviceTest, CanonicalizeAddressFormat_AcceptsAllValidFormats) { "1a2b3c4d5e6f", }; - for (size_t i = 0; i < arraysize(kValidFormats); ++i) { + for (size_t i = 0; i < base::size(kValidFormats); ++i) { SCOPED_TRACE(std::string("Input format: '") + kValidFormats[i] + "'"); EXPECT_EQ("1A:2B:3C:4D:5E:6F", BluetoothDevice::CanonicalizeAddress(kValidFormats[i])); @@ -90,7 +89,7 @@ TEST(BluetoothDeviceTest, CanonicalizeAddressFormat_RejectsInvalidFormats) { "1:A2:B3:C4:D5:E6F", }; - for (size_t i = 0; i < arraysize(kValidFormats); ++i) { + for (size_t i = 0; i < base::size(kValidFormats); ++i) { SCOPED_TRACE(std::string("Input format: '") + kValidFormats[i] + "'"); EXPECT_EQ(std::string(), BluetoothDevice::CanonicalizeAddress(kValidFormats[i])); diff --git a/device/bluetooth/bluetooth_gatt_descriptor.cc b/device/bluetooth/bluetooth_gatt_descriptor.cc index 4eab704df9938f..5ddfd469a162a9 100644 --- a/device/bluetooth/bluetooth_gatt_descriptor.cc +++ b/device/bluetooth/bluetooth_gatt_descriptor.cc @@ -8,6 +8,7 @@ #include #include "base/lazy_instance.h" +#include "base/stl_util.h" namespace device { namespace { @@ -24,7 +25,7 @@ struct UUIDs { "0x2900", "0x2901", "0x2902", "0x2903", "0x2904", "0x2905" }; - for (size_t i = 0; i < arraysize(strings); ++i) + for (size_t i = 0; i < base::size(strings); ++i) uuids.push_back(BluetoothUUID(strings[i])); return uuids; diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc index 0f388cdabfa9cc..967f2dc444c1ff 100644 --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc @@ -6,8 +6,8 @@ #include #include "base/bind.h" -#include "base/macros.h" #include "base/run_loop.h" +#include "base/stl_util.h" #include "base/test/bind_test_util.h" #include "build/build_config.h" #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" @@ -807,7 +807,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, MAYBE_WriteRemoteCharacteristic) { TestBluetoothAdapterObserver observer(adapter_); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); characteristic1_->WriteRemoteCharacteristic( test_vector, GetCallback(Call::EXPECTED), GetGattErrorCallback(Call::NOT_EXPECTED)); @@ -848,7 +848,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, GetGattErrorCallback(Call::NOT_EXPECTED)); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); SimulateGattCharacteristicRead(characteristic1_, test_vector); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, gatt_read_characteristic_attempts_); @@ -894,7 +894,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); characteristic1_->WriteRemoteCharacteristic( test_vector, GetCallback(Call::EXPECTED), GetGattErrorCallback(Call::NOT_EXPECTED)); diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc index 95f3d2222084ad..f1a79bfa1d12c5 100644 --- a/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc +++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/run_loop.h" +#include "base/stl_util.h" #include "build/build_config.h" #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" #include "device/bluetooth/bluetooth_remote_gatt_service.h" @@ -369,7 +370,7 @@ TEST_F(BluetoothRemoteGattDescriptorTest, MAYBE_ReadRemoteDescriptor) { EXPECT_EQ(1, gatt_read_descriptor_attempts_); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); SimulateGattDescriptorRead(descriptor1_, test_vector); base::RunLoop().RunUntilIdle(); @@ -400,7 +401,7 @@ TEST_F(BluetoothRemoteGattDescriptorTest, MAYBE_WriteRemoteDescriptor) { ASSERT_NO_FATAL_FAILURE(FakeDescriptorBoilerplate()); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); descriptor1_->WriteRemoteDescriptor(test_vector, GetCallback(Call::EXPECTED), GetGattErrorCallback(Call::NOT_EXPECTED)); EXPECT_EQ(1, gatt_write_descriptor_attempts_); @@ -433,7 +434,7 @@ TEST_F(BluetoothRemoteGattDescriptorTest, MAYBE_ReadRemoteDescriptor_Twice) { EXPECT_EQ(1, gatt_read_descriptor_attempts_); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); SimulateGattDescriptorRead(descriptor1_, test_vector); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, callback_count_); @@ -474,7 +475,7 @@ TEST_F(BluetoothRemoteGattDescriptorTest, MAYBE_WriteRemoteDescriptor_Twice) { ASSERT_NO_FATAL_FAILURE(FakeDescriptorBoilerplate()); uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); descriptor1_->WriteRemoteDescriptor(test_vector, GetCallback(Call::EXPECTED), GetGattErrorCallback(Call::NOT_EXPECTED)); EXPECT_EQ(1, gatt_write_descriptor_attempts_); @@ -988,7 +989,7 @@ TEST_F(BluetoothRemoteGattDescriptorTest, ReadRemoteDescriptor_NSNumber) { base::RunLoop().RunUntilIdle(); uint8_t values[] = {0x34, 0x12}; - std::vector test_vector(values, values + arraysize(values)); + std::vector test_vector(values, values + base::size(values)); EXPECT_EQ(test_vector, last_read_value_); EXPECT_EQ(test_vector, descriptor1_->GetValue()); } diff --git a/device/bluetooth/bluetooth_uuid_unittest.cc b/device/bluetooth/bluetooth_uuid_unittest.cc index 647ff2846f95e7..4f8942040c40c3 100644 --- a/device/bluetooth/bluetooth_uuid_unittest.cc +++ b/device/bluetooth/bluetooth_uuid_unittest.cc @@ -6,7 +6,7 @@ #include -#include "base/macros.h" +#include "base/stl_util.h" #include "base/strings/string_piece.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -141,7 +141,7 @@ TEST(BluetoothUUIDTest, BluetoothUUID_CaseInsensitive) { { "00001aBc-0000-1000-8000-00805F9b34fB", k128Bit }, }; - for (size_t i = 0; i < arraysize(test_cases); ++i) { + for (size_t i = 0; i < base::size(test_cases); ++i) { SCOPED_TRACE("Input UUID: " + test_cases[i].input_uuid); BluetoothUUID uuid(test_cases[i].input_uuid); EXPECT_TRUE(uuid.IsValid()); diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc index 6fd6336ffef49b..f3cf485b89dea8 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc +++ b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc @@ -12,8 +12,8 @@ #include #include "base/bind.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/stl_util.h" #include "device/bluetooth/dbus/bluetooth_media_client.h" #include "device/bluetooth/dbus/bluez_dbus_manager.h" #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" @@ -44,7 +44,7 @@ ObjectPath GenerateTransportPath() { } #define UINT8_VECTOR_FROM_ARRAY(array) \ - std::vector(array, array + arraysize(array)) + std::vector(array, array + base::size(array)) } // namespace @@ -57,7 +57,7 @@ const uint8_t FakeBluetoothMediaTransportClient::kTransportCodec = 0x00; const uint8_t FakeBluetoothMediaTransportClient::kTransportConfiguration[] = { 0x21, 0x15, 0x33, 0x2C}; const uint8_t FakeBluetoothMediaTransportClient::kTransportConfigurationLength = - arraysize(FakeBluetoothMediaTransportClient::kTransportConfiguration); + base::size(FakeBluetoothMediaTransportClient::kTransportConfiguration); const uint16_t FakeBluetoothMediaTransportClient::kTransportDelay = 5; const uint16_t FakeBluetoothMediaTransportClient::kTransportVolume = 50; const uint16_t FakeBluetoothMediaTransportClient::kDefaultReadMtu = 20; diff --git a/device/bluetooth/uribeacon/uri_encoder.cc b/device/bluetooth/uribeacon/uri_encoder.cc index 7c982f024e6103..4358475152b1d8 100644 --- a/device/bluetooth/uribeacon/uri_encoder.cc +++ b/device/bluetooth/uribeacon/uri_encoder.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/macros.h" #include "uri_encoder.h" +#include "base/stl_util.h" using base::StringPiece; @@ -70,26 +70,26 @@ struct expansion* CommonLookupExpansionByValue(struct expansion* table, struct expansion* LookupExpansionByValue(const std::string& input, int input_index) { return CommonLookupExpansionByValue( - expansions_list, arraysize(expansions_list), input, input_index); + expansions_list, base::size(expansions_list), input, input_index); } struct expansion* LookupPrefixExpansionByValue(const std::string& input, int input_index) { return CommonLookupExpansionByValue(prefix_expansions_list, - arraysize(prefix_expansions_list), input, + base::size(prefix_expansions_list), input, input_index); } struct expansion* LookupExpansionByCode(const std::vector& input, int input_index) { - if (input[input_index] >= arraysize(expansions_list)) + if (input[input_index] >= base::size(expansions_list)) return NULL; return &expansions_list[input[input_index]]; } struct expansion* LookupPrefixExpansionByCode(const std::vector& input, int input_index) { - if (input[input_index] >= arraysize(prefix_expansions_list)) + if (input[input_index] >= base::size(prefix_expansions_list)) return NULL; return &prefix_expansions_list[input[input_index]]; } diff --git a/device/fido/ctap_response_unittest.cc b/device/fido/ctap_response_unittest.cc index 609965c945e880..aa5a403186469e 100644 --- a/device/fido/ctap_response_unittest.cc +++ b/device/fido/ctap_response_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/stl_util.h" #include "components/cbor/reader.h" #include "components/cbor/values.h" #include "components/cbor/writer.h" @@ -298,7 +299,7 @@ std::vector GetTestSignResponse() { // Get a subset of the response for testing error handling. std::vector GetTestCorruptedSignResponse(size_t length) { - DCHECK_LE(length, arraysize(test_data::kTestU2fSignResponse)); + DCHECK_LE(length, base::size(test_data::kTestU2fSignResponse)); return fido_parsing_utils::Materialize(fido_parsing_utils::ExtractSpan( test_data::kTestU2fSignResponse, 0, length)); } diff --git a/device/gamepad/gamepad_platform_data_fetcher_linux.cc b/device/gamepad/gamepad_platform_data_fetcher_linux.cc index 50f9dbfd9ea9c4..2ed75341e217cf 100644 --- a/device/gamepad/gamepad_platform_data_fetcher_linux.cc +++ b/device/gamepad/gamepad_platform_data_fetcher_linux.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -77,7 +78,7 @@ void GamepadPlatformDataFetcherLinux::UpdateGamepadStrings( base::TruncateUTF8ToByteSize(id, Gamepad::kIdLengthCap - 1, &id); base::string16 tmp16 = base::UTF8ToUTF16(id); memset(pad->id, 0, sizeof(pad->id)); - tmp16.copy(pad->id, arraysize(pad->id) - 1); + tmp16.copy(pad->id, base::size(pad->id) - 1); // Set the mapper string to "standard" if the gamepad has a standard mapping, // or the empty string otherwise. @@ -87,7 +88,7 @@ void GamepadPlatformDataFetcherLinux::UpdateGamepadStrings( &mapping); tmp16 = base::UTF8ToUTF16(mapping); memset(pad->mapping, 0, sizeof(pad->mapping)); - tmp16.copy(pad->mapping, arraysize(pad->mapping) - 1); + tmp16.copy(pad->mapping, base::size(pad->mapping) - 1); } else { pad->mapping[0] = 0; } diff --git a/device/gamepad/raw_input_data_fetcher_win.cc b/device/gamepad/raw_input_data_fetcher_win.cc index b2ace74cdad00e..90caf3be38f699 100644 --- a/device/gamepad/raw_input_data_fetcher_win.cc +++ b/device/gamepad/raw_input_data_fetcher_win.cc @@ -6,7 +6,7 @@ #include -#include "base/macros.h" +#include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/trace_event/trace_event.h" #include "device/gamepad/gamepad_standard_mappings.h" @@ -43,7 +43,7 @@ void RawInputDataFetcher::OnAddedToProvider() { } RAWINPUTDEVICE* RawInputDataFetcher::GetRawInputDevices(DWORD flags) { - size_t usage_count = arraysize(DeviceUsages); + size_t usage_count = base::size(DeviceUsages); std::unique_ptr devices(new RAWINPUTDEVICE[usage_count]); for (size_t i = 0; i < usage_count; ++i) { devices[i].dwFlags = flags; @@ -78,7 +78,7 @@ void RawInputDataFetcher::StartMonitor() { // Register to receive raw HID input. std::unique_ptr devices( GetRawInputDevices(RIDEV_INPUTSINK)); - if (!::RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages), + if (!::RegisterRawInputDevices(devices.get(), base::size(DeviceUsages), sizeof(RAWINPUTDEVICE))) { PLOG(ERROR) << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK"; window_.reset(); @@ -96,7 +96,7 @@ void RawInputDataFetcher::StopMonitor() { DCHECK(window_); std::unique_ptr devices(GetRawInputDevices(RIDEV_REMOVE)); - if (!::RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages), + if (!::RegisterRawInputDevices(devices.get(), base::size(DeviceUsages), sizeof(RAWINPUTDEVICE))) { PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; } diff --git a/device/gamepad/xbox_data_fetcher_mac.cc b/device/gamepad/xbox_data_fetcher_mac.cc index 7c2de10f407c3c..5596503538d788 100644 --- a/device/gamepad/xbox_data_fetcher_mac.cc +++ b/device/gamepad/xbox_data_fetcher_mac.cc @@ -16,6 +16,7 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" +#include "base/stl_util.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -314,9 +315,9 @@ void XboxDataFetcher::AddController(XboxControllerMac* controller) { controller->SetLEDPattern((XboxControllerMac::LEDPattern)( XboxControllerMac::LED_FLASH_TOP_LEFT + controller->location_id())); - CopyToUString(state->data.id, arraysize(state->data.id), + CopyToUString(state->data.id, base::size(state->data.id), base::UTF8ToUTF16(controller->GetIdString())); - CopyToUString(state->data.mapping, arraysize(state->data.mapping), + CopyToUString(state->data.mapping, base::size(state->data.mapping), base::UTF8ToUTF16("standard")); state->data.connected = true; @@ -376,7 +377,7 @@ void XboxDataFetcher::XboxControllerGotData( pad.buttons[16].pressed = data.buttons[14]; pad.buttons[16].value = data.buttons[14] ? 1.0f : 0.0f; } - for (size_t i = 0; i < arraysize(data.axes); i++) { + for (size_t i = 0; i < base::size(data.axes); i++) { pad.axes[i] = data.axes[i]; } diff --git a/device/test/usb_test_gadget_impl.cc b/device/test/usb_test_gadget_impl.cc index a9032a2b516263..6c86bf40ae8dd4 100644 --- a/device/test/usb_test_gadget_impl.cc +++ b/device/test/usb_test_gadget_impl.cc @@ -15,7 +15,6 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/logging.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/path_service.h" @@ -23,6 +22,7 @@ #include "base/run_loop.h" #include "base/scoped_observer.h" #include "base/single_thread_task_runner.h" +#include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" @@ -437,7 +437,7 @@ class DeviceAddListener : public UsbService::Observer { const uint16_t product_id = device->product_id(); if (product_id_ == -1) { bool found = false; - for (size_t i = 0; i < arraysize(kConfigurations); ++i) { + for (size_t i = 0; i < base::size(kConfigurations); ++i) { if (product_id == kConfigurations[i].product_id) { found = true; break; @@ -569,7 +569,7 @@ bool UsbTestGadgetImpl::Unclaim() { bool UsbTestGadgetImpl::SetType(Type type) { const struct UsbTestGadgetConfiguration* config = NULL; - for (size_t i = 0; i < arraysize(kConfigurations); ++i) { + for (size_t i = 0; i < base::size(kConfigurations); ++i) { if (kConfigurations[i].type == type) { config = &kConfigurations[i]; } diff --git a/device/vr/openvr/test/fake_openvr_impl_api.cc b/device/vr/openvr/test/fake_openvr_impl_api.cc index e57421cd1cf709..877d920e0ec2e1 100644 --- a/device/vr/openvr/test/fake_openvr_impl_api.cc +++ b/device/vr/openvr/test/fake_openvr_impl_api.cc @@ -2,6 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include +#include +#include +#include + +#include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" #include "device/vr/openvr/test/test_helper.h" @@ -9,11 +15,6 @@ #include "third_party/openvr/src/headers/openvr.h" #include "third_party/openvr/src/src/ivrclientcore.h" -#include -#include -#include -#include - // TODO(https://crbug.com/892717): Update argument names to be consistent with // Chromium style guidelines. namespace vr { @@ -440,7 +441,7 @@ void TestVRSystem::GetDXGIOutputInfo(int32_t* adapter_index) { Microsoft::WRL::ComPtr d3d11_device_context; if (SUCCEEDED(D3D11CreateDevice( adapter.Get(), D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, feature_levels, - arraysize(feature_levels), D3D11_SDK_VERSION, + base::size(feature_levels), D3D11_SDK_VERSION, d3d11_device.GetAddressOf(), &feature_level_out, d3d11_device_context.GetAddressOf()))) { *adapter_index = i; diff --git a/device/vr/windows/d3d11_texture_helper.cc b/device/vr/windows/d3d11_texture_helper.cc index f24e9bea773fca..01e95c63e3f0fb 100644 --- a/device/vr/windows/d3d11_texture_helper.cc +++ b/device/vr/windows/d3d11_texture_helper.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "device/vr/windows/d3d11_texture_helper.h" +#include "base/stl_util.h" #include "mojo/public/c/system/platform_handle.h" namespace { @@ -559,8 +560,9 @@ bool D3D11TextureHelper::EnsureInitialized() { Microsoft::WRL::ComPtr d3d11_device; HRESULT hr = D3D11CreateDevice( adapter.Get(), D3D_DRIVER_TYPE_UNKNOWN, NULL, flags, feature_levels, - arraysize(feature_levels), D3D11_SDK_VERSION, d3d11_device.GetAddressOf(), - &feature_level_out, render_state_.d3d11_device_context_.GetAddressOf()); + base::size(feature_levels), D3D11_SDK_VERSION, + d3d11_device.GetAddressOf(), &feature_level_out, + render_state_.d3d11_device_context_.GetAddressOf()); if (SUCCEEDED(hr)) { hr = d3d11_device.As(&render_state_.d3d11_device_); if (FAILED(hr)) {