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

Unified Diff: components/font_service/public/cpp/font_loader.cc

Issue 1276163002: Revert of Sandbox html_viewer on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/font_service/public/cpp/font_loader.cc
diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc
deleted file mode 100644
index 8b6338481f54cde63cd87cbf6e3da2b9e555e0f6..0000000000000000000000000000000000000000
--- a/components/font_service/public/cpp/font_loader.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/font_service/public/cpp/font_loader.h"
-
-#include "components/font_service/public/cpp/font_service_thread.h"
-#include "mojo/application/public/cpp/application_impl.h"
-
-namespace font_service {
-
-FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) {
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("mojo:font_service");
- FontServicePtr font_service;
- application_impl->ConnectToService(request.Pass(), &font_service);
-
- thread_ = new internal::FontServiceThread(font_service.Pass());
-}
-
-FontLoader::~FontLoader() {}
-
-bool FontLoader::matchFamilyName(const char family_name[],
- SkTypeface::Style requested,
- FontIdentity* out_font_identifier,
- SkString* out_family_name,
- SkTypeface::Style* out_style) {
- return thread_->MatchFamilyName(family_name, requested, out_font_identifier,
- out_family_name, out_style);
-}
-
-SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) {
- {
- base::AutoLock lock(lock_);
- auto mapped_font_files_it = mapped_font_files_.find(identity.fID);
- if (mapped_font_files_it != mapped_font_files_.end())
- return mapped_font_files_it->second->CreateMemoryStream();
- }
-
- scoped_refptr<internal::MappedFontFile> mapped_font_file =
- thread_->OpenStream(identity);
- if (!mapped_font_file)
- return nullptr;
-
- // Get notified with |mapped_font_file| is destroyed.
- mapped_font_file->set_observer(this);
-
- {
- base::AutoLock lock(lock_);
- auto mapped_font_files_it =
- mapped_font_files_.insert(std::make_pair(mapped_font_file->font_id(),
- mapped_font_file.get()))
- .first;
- return mapped_font_files_it->second->CreateMemoryStream();
- }
-}
-
-void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) {
- base::AutoLock lock(lock_);
- mapped_font_files_.erase(f->font_id());
-}
-
-} // namespace font_service
« no previous file with comments | « components/font_service/public/cpp/font_loader.h ('k') | components/font_service/public/cpp/font_service_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698