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

Side by Side Diff: components/font_service/public/cpp/font_service_thread.cc

Issue 1925423002: font-service: Track one more pending WaitableEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/font_service/public/cpp/font_service_thread.h" 5 #include "components/font_service/public/cpp/font_service_thread.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 *out_valid = false; 97 *out_valid = false;
98 done_event->Signal(); 98 done_event->Signal();
99 return; 99 return;
100 } 100 }
101 101
102 TypefaceStylePtr style(TypefaceStyle::New()); 102 TypefaceStylePtr style(TypefaceStyle::New());
103 style->weight = requested_style.weight(); 103 style->weight = requested_style.weight();
104 style->width = requested_style.width(); 104 style->width = requested_style.width();
105 style->slant = static_cast<TypefaceSlant>(requested_style.slant()); 105 style->slant = static_cast<TypefaceSlant>(requested_style.slant());
106 106
107 pending_waitable_events_.insert(done_event);
107 font_service_->MatchFamilyName( 108 font_service_->MatchFamilyName(
108 mojo::String(family_name), std::move(style), 109 mojo::String(family_name), std::move(style),
109 base::Bind(&FontServiceThread::OnMatchFamilyNameComplete, this, 110 base::Bind(&FontServiceThread::OnMatchFamilyNameComplete, this,
110 done_event, out_valid, out_font_identity, out_family_name, 111 done_event, out_valid, out_font_identity, out_family_name,
111 out_style)); 112 out_style));
112 } 113 }
113 114
114 void FontServiceThread::OnMatchFamilyNameComplete( 115 void FontServiceThread::OnMatchFamilyNameComplete(
115 base::WaitableEvent* done_event, 116 base::WaitableEvent* done_event,
116 bool* out_valid, 117 bool* out_valid,
117 SkFontConfigInterface::FontIdentity* out_font_identity, 118 SkFontConfigInterface::FontIdentity* out_font_identity,
118 SkString* out_family_name, 119 SkString* out_family_name,
119 SkFontStyle* out_style, 120 SkFontStyle* out_style,
120 FontIdentityPtr font_identity, 121 FontIdentityPtr font_identity,
121 mojo::String family_name, 122 mojo::String family_name,
122 TypefaceStylePtr style) { 123 TypefaceStylePtr style) {
123 DCHECK_EQ(GetThreadId(), base::PlatformThread::CurrentId()); 124 DCHECK_EQ(GetThreadId(), base::PlatformThread::CurrentId());
125 pending_waitable_events_.erase(done_event);
124 126
125 *out_valid = font_identity; 127 *out_valid = font_identity;
126 if (font_identity) { 128 if (font_identity) {
127 out_font_identity->fID = font_identity->id; 129 out_font_identity->fID = font_identity->id;
128 out_font_identity->fTTCIndex = font_identity->ttc_index; 130 out_font_identity->fTTCIndex = font_identity->ttc_index;
129 out_font_identity->fString = font_identity->str_representation.data(); 131 out_font_identity->fString = font_identity->str_representation.data();
130 // TODO(erg): fStyle isn't set. This is rather odd, however it matches the 132 // TODO(erg): fStyle isn't set. This is rather odd, however it matches the
131 // behaviour of the current Linux IPC version. 133 // behaviour of the current Linux IPC version.
132 134
133 *out_family_name = family_name.data(); 135 *out_family_name = family_name.data();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 base::Bind(&FontServiceThread::OnFontServiceConnectionError, 183 base::Bind(&FontServiceThread::OnFontServiceConnectionError,
182 weak_factory_.GetWeakPtr())); 184 weak_factory_.GetWeakPtr()));
183 } 185 }
184 186
185 void FontServiceThread::CleanUp() { 187 void FontServiceThread::CleanUp() {
186 font_service_.reset(); 188 font_service_.reset();
187 } 189 }
188 190
189 } // namespace internal 191 } // namespace internal
190 } // namespace font_service 192 } // namespace font_service
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698