xref: /aosp_15_r20/external/cronet/base/win/atl_throw.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/win/atl_throw.h"
6 
7 #include <winerror.h>
8 
9 #include "base/compiler_specific.h"
10 #include "base/debug/alias.h"
11 #include "base/immediate_crash.h"
12 #include "base/process/memory.h"
13 
14 namespace base {
15 namespace win {
16 
AtlThrowImpl(HRESULT hr)17 NOINLINE void __stdcall AtlThrowImpl(HRESULT hr) {
18   base::debug::Alias(&hr);
19   if (hr == E_OUTOFMEMORY)
20     base::TerminateBecauseOutOfMemory(0);
21   ImmediateCrash();
22 }
23 
24 }  // namespace win
25 }  // namespace base
26