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

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

Issue 1341073004: Fix bug in shut down of HTMLViewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 2 trunk Created 5 years, 3 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 | « components/font_service/public/cpp/font_loader.h ('k') | components/html_viewer/global_state.h » ('j') | 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_loader.h" 5 #include "components/font_service/public/cpp/font_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/font_service/public/cpp/font_service_thread.h" 8 #include "components/font_service/public/cpp/font_service_thread.h"
9 #include "mojo/application/public/cpp/application_impl.h" 9 #include "mojo/application/public/cpp/application_impl.h"
10 #include "mojo/application/public/cpp/connect.h" 10 #include "mojo/application/public/cpp/connect.h"
(...skipping 21 matching lines...) Expand all
32 mojo::URLRequestPtr request(mojo::URLRequest::New()); 32 mojo::URLRequestPtr request(mojo::URLRequest::New());
33 request->url = mojo::String::From("mojo:font_service"); 33 request->url = mojo::String::From("mojo:font_service");
34 FontServicePtr font_service; 34 FontServicePtr font_service;
35 application_impl->ConnectToService(request.Pass(), &font_service); 35 application_impl->ConnectToService(request.Pass(), &font_service);
36 36
37 thread_ = new internal::FontServiceThread(font_service.Pass()); 37 thread_ = new internal::FontServiceThread(font_service.Pass());
38 } 38 }
39 39
40 FontLoader::~FontLoader() {} 40 FontLoader::~FontLoader() {}
41 41
42 void FontLoader::Shutdown() {
43 thread_->Stop();
44 thread_ = nullptr;
45 }
46
42 bool FontLoader::matchFamilyName(const char family_name[], 47 bool FontLoader::matchFamilyName(const char family_name[],
43 SkTypeface::Style requested, 48 SkTypeface::Style requested,
44 FontIdentity* out_font_identifier, 49 FontIdentity* out_font_identifier,
45 SkString* out_family_name, 50 SkString* out_family_name,
46 SkTypeface::Style* out_style) { 51 SkTypeface::Style* out_style) {
47 return thread_->MatchFamilyName(family_name, requested, out_font_identifier, 52 return thread_->MatchFamilyName(family_name, requested, out_font_identifier,
48 out_family_name, out_style); 53 out_family_name, out_style);
49 } 54 }
50 55
51 SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) { 56 SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) {
(...skipping 21 matching lines...) Expand all
73 return mapped_font_files_it->second->CreateMemoryStream(); 78 return mapped_font_files_it->second->CreateMemoryStream();
74 } 79 }
75 } 80 }
76 81
77 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) { 82 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) {
78 base::AutoLock lock(lock_); 83 base::AutoLock lock(lock_);
79 mapped_font_files_.erase(f->font_id()); 84 mapped_font_files_.erase(f->font_id());
80 } 85 }
81 86
82 } // namespace font_service 87 } // namespace font_service
OLDNEW
« no previous file with comments | « components/font_service/public/cpp/font_loader.h ('k') | components/html_viewer/global_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698