| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/text/ICUError.h" | 5 #include "platform/text/ICUError.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 // Distinguish memory allocation failures from other errors. | 9 // Distinguish memory allocation failures from other errors. |
| 10 // https://groups.google.com/a/chromium.org/d/msg/platform-architecture-dev/MP0k
9WGnCjA/zIBiJtilBwAJ | 10 // https://groups.google.com/a/chromium.org/d/msg/platform-architecture-dev/MP0k
9WGnCjA/zIBiJtilBwAJ |
| 11 static NEVER_INLINE void ICUOutOfMemory() { | 11 static NEVER_INLINE void ICUOutOfMemory() { |
| 12 OOM_CRASH(); | 12 OOM_CRASH(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 void ICUError::handleFailure() { | 15 void ICUError::handleFailure() { |
| 16 switch (m_error) { | 16 switch (m_error) { |
| 17 case U_MEMORY_ALLOCATION_ERROR: | 17 case U_MEMORY_ALLOCATION_ERROR: |
| 18 ICUOutOfMemory(); | 18 ICUOutOfMemory(); |
| 19 break; | 19 break; |
| 20 case U_ILLEGAL_ARGUMENT_ERROR: | 20 case U_ILLEGAL_ARGUMENT_ERROR: |
| 21 CHECK(false) << m_error; | 21 CHECK(false); |
| 22 break; | 22 break; |
| 23 default: | 23 default: |
| 24 break; | 24 break; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 } // namespace blink | 28 } // namespace blink |
| OLD | NEW |