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

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

Issue 2957513002: Removed calls to RefPtr::Release in return statements with auto move. (Closed)
Patch Set: rebased Created 3 years, 5 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 #include "platform/fonts/shaping/CachingWordShapeIterator.h" 5 #include "platform/fonts/shaping/CachingWordShapeIterator.h"
6 6
7 #include "platform/fonts/shaping/HarfBuzzShaper.h" 7 #include "platform/fonts/shaping/HarfBuzzShaper.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 PassRefPtr<const ShapeResult> CachingWordShapeIterator::ShapeWordWithoutSpacing( 11 PassRefPtr<const ShapeResult> CachingWordShapeIterator::ShapeWordWithoutSpacing(
12 const TextRun& word_run, 12 const TextRun& word_run,
13 const Font* font) { 13 const Font* font) {
14 ShapeCacheEntry* cache_entry = shape_cache_->Add(word_run, ShapeCacheEntry()); 14 ShapeCacheEntry* cache_entry = shape_cache_->Add(word_run, ShapeCacheEntry());
15 if (cache_entry && cache_entry->shape_result_) 15 if (cache_entry && cache_entry->shape_result_)
16 return cache_entry->shape_result_; 16 return cache_entry->shape_result_;
17 17
18 unsigned word_length = 0; 18 unsigned word_length = 0;
19 std::unique_ptr<UChar[]> word_text = word_run.NormalizedUTF16(&word_length); 19 std::unique_ptr<UChar[]> word_text = word_run.NormalizedUTF16(&word_length);
20 20
21 HarfBuzzShaper shaper(word_text.get(), word_length); 21 HarfBuzzShaper shaper(word_text.get(), word_length);
22 RefPtr<const ShapeResult> shape_result = 22 RefPtr<const ShapeResult> shape_result =
23 shaper.Shape(font, word_run.Direction()); 23 shaper.Shape(font, word_run.Direction());
24 if (!shape_result) 24 if (!shape_result)
25 return nullptr; 25 return nullptr;
26 26
27 if (cache_entry) 27 if (cache_entry)
28 cache_entry->shape_result_ = shape_result; 28 cache_entry->shape_result_ = shape_result;
29 29
30 return shape_result.Release(); 30 return shape_result;
31 } 31 }
32 32
33 } // namespace blink 33 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698