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

Side by Side Diff: third_party/WebKit/Source/platform/text/ICUError.h

Issue 2606183002: Fix build of own emoji functions (Closed)
Patch Set: Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
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 #ifndef ICUError_h 5 #ifndef ICUError_h
6 #define ICUError_h 6 #define ICUError_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
11 #include <unicode/utypes.h> 11 #include <unicode/utypes.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // ICUError provides the unified way to handle ICU errors in Blink. 15 // ICUError provides the unified way to handle ICU errors in Blink.
16 class PLATFORM_EXPORT ICUError { 16 class PLATFORM_EXPORT ICUError {
17 STACK_ALLOCATED(); 17 STACK_ALLOCATED();
18 18
19 public: 19 public:
20 ~ICUError() { crashIfCritical(); } 20 ~ICUError() { crashIfCritical(); }
21 21
22 UErrorCode* operator&() { return &m_error; } 22 UErrorCode* operator&() { return &m_error; }
23 operator UErrorCode() const { return m_error; } 23 operator UErrorCode() const { return m_error; }
24 operator UErrorCode&() { return m_error; }
24 25
25 void operator=(UErrorCode error) { m_error = error; } 26 void operator=(UErrorCode error) { m_error = error; }
26 27
27 // Crash the renderer in the appropriate way if critical failure occurred. 28 // Crash the renderer in the appropriate way if critical failure occurred.
28 void crashIfCritical(); 29 void crashIfCritical();
29 30
30 private: 31 private:
31 UErrorCode m_error = U_ZERO_ERROR; 32 UErrorCode m_error = U_ZERO_ERROR;
32 33
33 void handleFailure(); 34 void handleFailure();
34 }; 35 };
35 36
36 inline void ICUError::crashIfCritical() { 37 inline void ICUError::crashIfCritical() {
37 if (U_FAILURE(m_error)) 38 if (U_FAILURE(m_error))
38 handleFailure(); 39 handleFailure();
39 } 40 }
40 41
41 } // namespace blink 42 } // namespace blink
42 43
43 #endif // ICUError_h 44 #endif // ICUError_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/CharacterEmoji.cpp ('k') | third_party/WebKit/Source/platform/text/ICUErrorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698