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

Side by Side Diff: content/test/dwrite_font_fake_sender_win.cc

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent 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
« no previous file with comments | « content/test/dwrite_font_fake_sender_win.h ('k') | content/test/fake_compositor_dependencies.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/dwrite_font_fake_sender_win.h" 5 #include "content/test/dwrite_font_fake_sender_win.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 8
9 #include "content/common/dwrite_font_proxy_messages.h" 9 #include "content/common/dwrite_font_proxy_messages.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 IPC::Sender* FakeFontCollection::GetTrackingSender() { 62 IPC::Sender* FakeFontCollection::GetTrackingSender() {
63 return new FakeSender(this, true /* track_messages */); 63 return new FakeSender(this, true /* track_messages */);
64 } 64 }
65 65
66 FakeFontCollection::ReplySender::ReplySender(FakeFontCollection* collection) 66 FakeFontCollection::ReplySender::ReplySender(FakeFontCollection* collection)
67 : collection_(collection) {} 67 : collection_(collection) {}
68 68
69 FakeFontCollection::ReplySender::~ReplySender() = default; 69 FakeFontCollection::ReplySender::~ReplySender() = default;
70 70
71 scoped_ptr<IPC::Message>& FakeFontCollection::ReplySender::OnMessageReceived( 71 std::unique_ptr<IPC::Message>&
72 const IPC::Message& msg) { 72 FakeFontCollection::ReplySender::OnMessageReceived(const IPC::Message& msg) {
73 reply_.reset(); 73 reply_.reset();
74 bool handled = true; 74 bool handled = true;
75 IPC_BEGIN_MESSAGE_MAP(ReplySender, msg) 75 IPC_BEGIN_MESSAGE_MAP(ReplySender, msg)
76 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_FindFamily, OnFindFamily) 76 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_FindFamily, OnFindFamily)
77 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFamilyCount, OnGetFamilyCount) 77 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFamilyCount, OnGetFamilyCount)
78 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFamilyNames, OnGetFamilyNames) 78 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFamilyNames, OnGetFamilyNames)
79 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFontFiles, OnGetFontFiles) 79 IPC_MESSAGE_HANDLER(DWriteFontProxyMsg_GetFontFiles, OnGetFontFiles)
80 IPC_MESSAGE_UNHANDLED(handled = false) 80 IPC_MESSAGE_UNHANDLED(handled = false)
81 IPC_END_MESSAGE_MAP() 81 IPC_END_MESSAGE_MAP()
82 return reply_; 82 return reply_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 FakeFontCollection::FakeSender::~FakeSender() = default; 116 FakeFontCollection::FakeSender::~FakeSender() = default;
117 117
118 bool FakeFontCollection::FakeSender::Send(IPC::Message* message) { 118 bool FakeFontCollection::FakeSender::Send(IPC::Message* message) {
119 std::unique_ptr<IPC::Message> incoming_message; 119 std::unique_ptr<IPC::Message> incoming_message;
120 if (track_messages_) 120 if (track_messages_)
121 collection_->messages_.emplace_back(message); 121 collection_->messages_.emplace_back(message);
122 else 122 else
123 incoming_message.reset(message); // Ensure message is deleted. 123 incoming_message.reset(message); // Ensure message is deleted.
124 std::unique_ptr<ReplySender> sender = collection_->GetReplySender(); 124 std::unique_ptr<ReplySender> sender = collection_->GetReplySender();
125 scoped_ptr<IPC::Message> reply; 125 std::unique_ptr<IPC::Message> reply;
126 reply.swap(sender->OnMessageReceived(*message)); 126 reply.swap(sender->OnMessageReceived(*message));
127 127
128 IPC::SyncMessage* sync_message = reinterpret_cast<IPC::SyncMessage*>(message); 128 IPC::SyncMessage* sync_message = reinterpret_cast<IPC::SyncMessage*>(message);
129 scoped_ptr<IPC::MessageReplyDeserializer> serializer( 129 std::unique_ptr<IPC::MessageReplyDeserializer> serializer(
130 sync_message->GetReplyDeserializer()); 130 sync_message->GetReplyDeserializer());
131 serializer->SerializeOutputParameters(*(reply.get())); 131 serializer->SerializeOutputParameters(*(reply.get()));
132 return true; 132 return true;
133 } 133 }
134 134
135 void FakeFontCollection::OnFindFamily(const base::string16& family_name, 135 void FakeFontCollection::OnFindFamily(const base::string16& family_name,
136 uint32_t* index) { 136 uint32_t* index) {
137 for (size_t n = 0; n < fonts_.size(); n++) { 137 for (size_t n = 0; n < fonts_.size(); n++) {
138 if (_wcsicmp(family_name.data(), fonts_[n].font_name_.data()) == 0) { 138 if (_wcsicmp(family_name.data(), fonts_[n].font_name_.data()) == 0) {
139 *index = n; 139 *index = n;
(...skipping 25 matching lines...) Expand all
165 165
166 std::unique_ptr<FakeFontCollection::ReplySender> 166 std::unique_ptr<FakeFontCollection::ReplySender>
167 FakeFontCollection::GetReplySender() { 167 FakeFontCollection::GetReplySender() {
168 return std::unique_ptr<FakeFontCollection::ReplySender>( 168 return std::unique_ptr<FakeFontCollection::ReplySender>(
169 new FakeFontCollection::ReplySender(this)); 169 new FakeFontCollection::ReplySender(this));
170 } 170 }
171 171
172 FakeFontCollection::~FakeFontCollection() = default; 172 FakeFontCollection::~FakeFontCollection() = default;
173 173
174 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « content/test/dwrite_font_fake_sender_win.h ('k') | content/test/fake_compositor_dependencies.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698