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

Side by Side Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc

Issue 1862693002: Replace skia::RefPtr with sk_sp<> in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reviews Created 4 years, 8 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 "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" 5 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/debug/alias.h" 11 #include "base/debug/alias.h"
12 #include "base/win/iat_patch_function.h" 12 #include "base/win/iat_patch_function.h"
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_win.h" 14 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_win.h"
15 #include "content/child/font_warmup_win.h" 15 #include "content/child/font_warmup_win.h"
16 #include "skia/ext/fontmgr_default_win.h" 16 #include "skia/ext/fontmgr_default_win.h"
17 #include "skia/ext/refptr.h"
18 #include "third_party/WebKit/public/web/win/WebFontRendering.h" 17 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
19 #include "third_party/skia/include/ports/SkFontMgr.h" 18 #include "third_party/skia/include/ports/SkFontMgr.h"
20 #include "third_party/skia/include/ports/SkTypeface_win.h" 19 #include "third_party/skia/include/ports/SkTypeface_win.h"
21 20
22 namespace mswr = Microsoft::WRL; 21 namespace mswr = Microsoft::WRL;
23 22
24 namespace content { 23 namespace content {
25 24
26 namespace { 25 namespace {
27 26
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void InitializeDWriteFontProxy() { 64 void InitializeDWriteFontProxy() {
66 mswr::ComPtr<IDWriteFactory> factory; 65 mswr::ComPtr<IDWriteFactory> factory;
67 66
68 CreateDirectWriteFactory(&factory); 67 CreateDirectWriteFactory(&factory);
69 68
70 if (!g_font_collection) { 69 if (!g_font_collection) {
71 mswr::MakeAndInitialize<DWriteFontCollectionProxy>( 70 mswr::MakeAndInitialize<DWriteFontCollectionProxy>(
72 &g_font_collection, factory.Get(), g_sender_override); 71 &g_font_collection, factory.Get(), g_sender_override);
73 } 72 }
74 73
75 skia::RefPtr<SkFontMgr> skia_font_manager = skia::AdoptRef( 74 sk_sp<SkFontMgr> skia_font_manager(
76 SkFontMgr_New_DirectWrite(factory.Get(), g_font_collection.Get())); 75 SkFontMgr_New_DirectWrite(factory.Get(), g_font_collection.Get()));
77 blink::WebFontRendering::setSkiaFontManager(skia_font_manager.get()); 76 blink::WebFontRendering::setSkiaFontManager(skia_font_manager.get());
78 77
79 // Add an extra ref for SetDefaultSkiaFactory, which keeps a ref but doesn't 78 // Add an extra ref for SetDefaultSkiaFactory, which keeps a ref but doesn't
80 // addref. 79 // addref.
81 skia_font_manager->ref(); 80 skia_font_manager->ref();
82 SetDefaultSkiaFactory(skia_font_manager.get()); 81 SetDefaultSkiaFactory(skia_font_manager.get());
83 } 82 }
84 83
85 void UninitializeDWriteFontProxy() { 84 void UninitializeDWriteFontProxy() {
86 if (g_font_collection) 85 if (g_font_collection)
87 g_font_collection->Unregister(); 86 g_font_collection->Unregister();
88 } 87 }
89 88
90 void SetDWriteFontProxySenderForTesting(IPC::Sender* sender) { 89 void SetDWriteFontProxySenderForTesting(IPC::Sender* sender) {
91 g_sender_override = sender; 90 g_sender_override = sender;
92 } 91 }
93 92
94 } // namespace content 93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698