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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 2807913002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/fonts (Closed)
Patch Set: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/fonts Created 3 years, 8 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 /* 1 /*
2 * Copyright (c) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 template <typename T> 65 template <typename T>
66 class HarfBuzzScopedPtr { 66 class HarfBuzzScopedPtr {
67 STACK_ALLOCATED(); 67 STACK_ALLOCATED();
68 WTF_MAKE_NONCOPYABLE(HarfBuzzScopedPtr); 68 WTF_MAKE_NONCOPYABLE(HarfBuzzScopedPtr);
69 69
70 public: 70 public:
71 typedef void (*DestroyFunction)(T*); 71 typedef void (*DestroyFunction)(T*);
72 72
73 HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy) 73 HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy)
74 : m_ptr(ptr), m_destroy(destroy) { 74 : m_ptr(ptr), m_destroy(destroy) {
75 ASSERT(m_destroy); 75 DCHECK(m_destroy);
76 } 76 }
77 ~HarfBuzzScopedPtr() { 77 ~HarfBuzzScopedPtr() {
78 if (m_ptr) 78 if (m_ptr)
79 (*m_destroy)(m_ptr); 79 (*m_destroy)(m_ptr);
80 } 80 }
81 81
82 T* get() { return m_ptr; } 82 T* get() { return m_ptr; }
83 void set(T* ptr) { m_ptr = ptr; } 83 void set(T* ptr) { m_ptr = ptr; }
84 84
85 private: 85 private:
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 if (currentClusterResult == Shaped && !isLastResort) { 250 if (currentClusterResult == Shaped && !isLastResort) {
251 // Now it's clear that we need to continue processing. 251 // Now it's clear that we need to continue processing.
252 if (!fontCycleQueued) { 252 if (!fontCycleQueued) {
253 rangeData->holesQueue.push_back( 253 rangeData->holesQueue.push_back(
254 HolesQueueItem(HolesQueueNextFont, 0, 0)); 254 HolesQueueItem(HolesQueueNextFont, 0, 0));
255 fontCycleQueued = true; 255 fontCycleQueued = true;
256 } 256 }
257 257
258 // Here we need to put character positions. 258 // Here we need to put character positions.
259 ASSERT(numCharacters); 259 DCHECK(numCharacters);
260 rangeData->holesQueue.push_back( 260 rangeData->holesQueue.push_back(
261 HolesQueueItem(HolesQueueRange, startIndex, numCharacters)); 261 HolesQueueItem(HolesQueueRange, startIndex, numCharacters));
262 } 262 }
263 263
264 // If numCharacters is 0, that means we hit a NotDef before shaping the 264 // If numCharacters is 0, that means we hit a NotDef before shaping the
265 // whole grapheme. We do not append it here. For the next glyph we 265 // whole grapheme. We do not append it here. For the next glyph we
266 // encounter, atChange will be true, and the characters corresponding to 266 // encounter, atChange will be true, and the characters corresponding to
267 // the grapheme will be added to the TODO queue again, attempting to 267 // the grapheme will be added to the TODO queue again, attempting to
268 // shape the whole grapheme with the next font. 268 // shape the whole grapheme with the next font.
269 // When we're getting here with the last resort font, we have no other 269 // When we're getting here with the last resort font, we have no other
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return false; 304 return false;
305 305
306 hint.clear(); 306 hint.clear();
307 307
308 size_t numCharsAdded = 0; 308 size_t numCharsAdded = 0;
309 for (auto it = holesQueue.begin(); it != holesQueue.end(); ++it) { 309 for (auto it = holesQueue.begin(); it != holesQueue.end(); ++it) {
310 if (it->m_action == HolesQueueNextFont) 310 if (it->m_action == HolesQueueNextFont)
311 break; 311 break;
312 312
313 UChar32 hintChar; 313 UChar32 hintChar;
314 RELEASE_ASSERT(it->m_startIndex + it->m_numCharacters <= m_textLength); 314 CHECK_LE(it->m_startIndex + it->m_numCharacters, m_textLength);
315 UTF16TextIterator iterator(m_text + it->m_startIndex, it->m_numCharacters); 315 UTF16TextIterator iterator(m_text + it->m_startIndex, it->m_numCharacters);
316 while (iterator.consume(hintChar)) { 316 while (iterator.consume(hintChar)) {
317 hint.push_back(hintChar); 317 hint.push_back(hintChar);
318 numCharsAdded++; 318 numCharsAdded++;
319 iterator.advance(); 319 iterator.advance();
320 } 320 }
321 } 321 }
322 return numCharsAdded > 0; 322 return numCharsAdded > 0;
323 } 323 }
324 324
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 } 701 }
702 return result.release(); 702 return result.release();
703 } 703 }
704 704
705 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font, 705 PassRefPtr<ShapeResult> HarfBuzzShaper::shape(const Font* font,
706 TextDirection direction) const { 706 TextDirection direction) const {
707 return shape(font, direction, 0, m_textLength); 707 return shape(font, direction, 0, m_textLength);
708 } 708 }
709 709
710 } // namespace blink 710 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698