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

Unified Diff: third_party/WebKit/Source/platform/text/ICUError.cpp

Issue 2527183002: Add ICUError to handle ICU failures (Closed)
Patch Set: eae review, add invalid argument error Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/text/ICUError.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/text/ICUError.cpp
diff --git a/third_party/WebKit/Source/platform/text/ICUError.cpp b/third_party/WebKit/Source/platform/text/ICUError.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..33d64313cd135530ed4db49d523f9f62f64e71f2
--- /dev/null
+++ b/third_party/WebKit/Source/platform/text/ICUError.cpp
@@ -0,0 +1,28 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/text/ICUError.h"
+
+namespace blink {
+
+// Distinguish memory allocation failures from other errors.
+// https://groups.google.com/a/chromium.org/d/msg/platform-architecture-dev/MP0k9WGnCjA/zIBiJtilBwAJ
+static NEVER_INLINE void ICUOutOfMemory() {
+ OOM_CRASH();
+}
+
+void ICUError::handleFailure() {
+ switch (m_error) {
+ case U_MEMORY_ALLOCATION_ERROR:
+ ICUOutOfMemory();
+ break;
+ case U_ILLEGAL_ARGUMENT_ERROR:
+ CHECK(false) << m_error;
+ break;
+ default:
+ break;
+ }
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/text/ICUError.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698