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

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

Issue 1282903002: mandoline: Sandbox mojo:browser and mojo:omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch touch ups. 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 unified diff | Download patch
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 "components/font_service/public/cpp/font_service_thread.h" 7 #include "components/font_service/public/cpp/font_service_thread.h"
8 #include "mojo/application/public/cpp/application_impl.h" 8 #include "mojo/application/public/cpp/application_impl.h"
9 #include "mojo/application/public/cpp/connect.h"
10 #include "mojo/application/public/interfaces/shell.mojom.h"
9 11
10 namespace font_service { 12 namespace font_service {
11 13
14 FontLoader::FontLoader(mojo::Shell* shell) {
15 mojo::ServiceProviderPtr font_service_provider;
16 mojo::URLRequestPtr request(mojo::URLRequest::New());
17 request->url = mojo::String::From("mojo:font_service");
18 FontServicePtr font_service;
19 shell->ConnectToApplication(request.Pass(),
20 GetProxy(&font_service_provider),
21 nullptr,
22 nullptr);
23 mojo::ConnectToService(font_service_provider.get(), &font_service);
24
25 thread_ = new internal::FontServiceThread(font_service.Pass());
26 }
27
12 FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) { 28 FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) {
13 mojo::URLRequestPtr request(mojo::URLRequest::New()); 29 mojo::URLRequestPtr request(mojo::URLRequest::New());
14 request->url = mojo::String::From("mojo:font_service"); 30 request->url = mojo::String::From("mojo:font_service");
15 FontServicePtr font_service; 31 FontServicePtr font_service;
16 application_impl->ConnectToService(request.Pass(), &font_service); 32 application_impl->ConnectToService(request.Pass(), &font_service);
17 33
18 thread_ = new internal::FontServiceThread(font_service.Pass()); 34 thread_ = new internal::FontServiceThread(font_service.Pass());
19 } 35 }
20 36
21 FontLoader::~FontLoader() {} 37 FontLoader::~FontLoader() {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return mapped_font_files_it->second->CreateMemoryStream(); 70 return mapped_font_files_it->second->CreateMemoryStream();
55 } 71 }
56 } 72 }
57 73
58 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) { 74 void FontLoader::OnMappedFontFileDestroyed(internal::MappedFontFile* f) {
59 base::AutoLock lock(lock_); 75 base::AutoLock lock(lock_);
60 mapped_font_files_.erase(f->font_id()); 76 mapped_font_files_.erase(f->font_id());
61 } 77 }
62 78
63 } // namespace font_service 79 } // namespace font_service
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698