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

Unified Diff: blimp/engine/mojo/font_fetcher_mojo_impl.cc

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 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
« no previous file with comments | « blimp/engine/mojo/font_fetcher_mojo_impl.h ('k') | blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/mojo/font_fetcher_mojo_impl.cc
diff --git a/blimp/engine/mojo/font_fetcher_mojo_impl.cc b/blimp/engine/mojo/font_fetcher_mojo_impl.cc
deleted file mode 100644
index d055e15c19c6d5ea6591094064e8124453090bbf..0000000000000000000000000000000000000000
--- a/blimp/engine/mojo/font_fetcher_mojo_impl.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 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 "blimp/engine/mojo/font_fetcher_mojo_impl.h"
-
-#include <stdint.h>
-#include <memory>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "blimp/engine/browser/font_data_fetcher.h"
-#include "mojo/public/cpp/system/buffer.h"
-#include "third_party/skia/include/core/SkStream.h"
-
-namespace blimp {
-namespace engine {
-
-namespace {
-
-void ReturnFontRequestResponse(
- const FontFetcherMojoImpl::GetFontStreamCallback& callback,
- std::unique_ptr<SkStream> font_stream) {
- uint32_t font_stream_size = font_stream->getLength();
- if (font_stream_size == 0) {
- LOG(WARNING) << "Font data not available.";
- callback.Run(mojo::ScopedSharedBufferHandle(), 0);
- return;
- }
-
- mojo::ScopedSharedBufferHandle handle =
- mojo::SharedBufferHandle::Create(font_stream_size);
- if (!handle.is_valid()) {
- LOG(ERROR) << "Failed to create SharedBufferHandle of " << font_stream_size
- << " bytes.";
- callback.Run(mojo::ScopedSharedBufferHandle(), 0);
- return;
- }
-
- mojo::ScopedSharedBufferMapping mapping = handle->Map(font_stream_size);
- if (!mapping) {
- LOG(ERROR) << "Failed to mmap region of " << font_stream_size << " bytes.";
- callback.Run(mojo::ScopedSharedBufferHandle(), 0);
- return;
- }
-
- uint32_t bytes_read = font_stream->read(mapping.get(), font_stream_size);
- DCHECK_EQ(bytes_read, font_stream_size);
- if (bytes_read < font_stream_size) {
- LOG(ERROR) << "SKStream read failed. Read " << bytes_read
- << " bytes, should read " << font_stream_size << "bytes";
- callback.Run(mojo::ScopedSharedBufferHandle(), 0);
- return;
- }
-
- callback.Run(handle->Clone(mojo::SharedBufferHandle::AccessMode::READ_ONLY),
- font_stream_size);
-}
-
-} // namespace
-
-FontFetcherMojoImpl::FontFetcherMojoImpl(FontDataFetcher* font_data_fetcher)
- : font_data_fetcher_(font_data_fetcher) {
- DCHECK(font_data_fetcher_);
-}
-
-FontFetcherMojoImpl::~FontFetcherMojoImpl() {}
-
-void FontFetcherMojoImpl::GetFontStream(const std::string& font_hash,
- const GetFontStreamCallback& callback) {
- VLOG(1) << "FontFetcherIPC::GetFontStream called for font_hash "
- << font_hash;
-
- font_data_fetcher_->FetchFontStream(
- font_hash, base::Bind(&ReturnFontRequestResponse, callback));
-}
-
-void FontFetcherMojoImpl::BindRequest(
- mojo::InterfaceRequest<mojom::FontFetcher> request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-} // namespace engine
-} // namespace blimp
« no previous file with comments | « blimp/engine/mojo/font_fetcher_mojo_impl.h ('k') | blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698