• Nico Weber's avatar
    Make SerialIoHandlerWin::UiThreadHelper final. · db730725
    Nico Weber authored
    Fixes the clang/win build after https://codereview.chromium.org/1439443002/
    clang rightfully complains that UiThreadHelper has virtual methods, is
    deleted polymorphically, and doesn't have a virtual destructor:
    
    ..\..\base/sequenced_task_runner_helpers.h(40,5) :  error: delete called on 'const device::SerialIoHandlerWin::UiThreadHelper' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
        delete reinterpret_cast<const T*>(object);
        ^
    ..\..\base/sequenced_task_runner_helpers.h(86,38) :  note: in instantiation of member function 'base::DeleteHelper<device::SerialIoHandlerWin::UiThreadHelper>::DoDelete' requested here
            from_here, &DeleteHelper<T>::DoDelete, object);
                                         ^
    ..\..\base/sequenced_task_runner.h(126,48) :  note: in instantiation of function template specialization 'base::subtle::DeleteHelperInternal<device::SerialIoHandlerWin::UiThreadHelper, bool>::DeleteViaSequencedTaskRunner<base::SequencedTaskRunner>' requested here
            subtle::DeleteHelperInternal<T, bool>::DeleteViaSequencedTaskRunner(
                                                   ^
    ..\..\device\serial\serial_io_handler_win.cc(374,28) :  note: in instantiation of function template specialization 'base::SequencedTaskRunner::DeleteSoon<device::SerialIoHandlerWin::UiThreadHelper>' requested here
      ui_thread_task_runner()->DeleteSoon(FROM_HERE, helper_);
                               ^
    
    Making the class final fixes this as it makes sure that nobody adds
    a subclass of UiThreadHelper.
    
    Also don't mix initializer styles for the different fields of this
    class.
    
    No intended behavior change.
    
    BUG=82385
    TBR=juncai
    
    Review URL: https://codereview.chromium.org/1470983002 .
    
    Cr-Commit-Position: refs/heads/master@{#361117}
    db730725
serial_io_handler_win.cc 17.2 KB