| OLD | NEW |
| 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 "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "components/font_service/public/cpp/font_service_thread.h" | 9 #include "components/font_service/public/cpp/font_service_thread.h" |
| 10 #include "mojo/application/public/cpp/application_impl.h" | 10 #include "mojo/application/public/cpp/application_impl.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 FontServicePtr font_service; | 23 FontServicePtr font_service; |
| 24 shell->ConnectToApplication(request.Pass(), GetProxy(&font_service_provider), | 24 shell->ConnectToApplication(request.Pass(), GetProxy(&font_service_provider), |
| 25 nullptr, nullptr, | 25 nullptr, nullptr, |
| 26 base::Bind(&OnGotContentHandlerID)); | 26 base::Bind(&OnGotContentHandlerID)); |
| 27 mojo::ConnectToService(font_service_provider.get(), &font_service); | 27 mojo::ConnectToService(font_service_provider.get(), &font_service); |
| 28 | 28 |
| 29 thread_ = new internal::FontServiceThread(font_service.Pass()); | 29 thread_ = new internal::FontServiceThread(font_service.Pass()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) { | 32 FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) { |
| 33 mojo::URLRequestPtr request(mojo::URLRequest::New()); | |
| 34 request->url = mojo::String::From("mojo:font_service"); | |
| 35 FontServicePtr font_service; | 33 FontServicePtr font_service; |
| 36 application_impl->ConnectToService(request.Pass(), &font_service); | 34 application_impl->ConnectToService("mojo:font_service", &font_service); |
| 37 | 35 |
| 38 thread_ = new internal::FontServiceThread(font_service.Pass()); | 36 thread_ = new internal::FontServiceThread(font_service.Pass()); |
| 39 } | 37 } |
| 40 | 38 |
| 41 FontLoader::~FontLoader() {} | 39 FontLoader::~FontLoader() {} |
| 42 | 40 |
| 43 void FontLoader::Shutdown() { | 41 void FontLoader::Shutdown() { |
| 44 thread_->Stop(); | 42 thread_->Stop(); |
| 45 thread_ = nullptr; | 43 thread_ = nullptr; |
| 46 } | 44 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 84 } |
| 87 | 85 |
| 88 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) { | 86 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) { |
| 89 TRACE_EVENT1("font_loader", "FontLoader::OnMappedFontFileDestroyed", | 87 TRACE_EVENT1("font_loader", "FontLoader::OnMappedFontFileDestroyed", |
| 90 "identity", f->font_id()); | 88 "identity", f->font_id()); |
| 91 base::AutoLock lock(lock_); | 89 base::AutoLock lock(lock_); |
| 92 mapped_font_files_.erase(f->font_id()); | 90 mapped_font_files_.erase(f->font_id()); |
| 93 } | 91 } |
| 94 | 92 |
| 95 } // namespace font_service | 93 } // namespace font_service |
| OLD | NEW |