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

Side by Side Diff: content/child/child_shared_bitmap_manager.cc

Issue 897563002: Unify the three places that patch font loading for PDFium on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/child_shared_bitmap_manager.h" 5 #include "content/child/child_shared_bitmap_manager.h"
6 6
7 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
8 #include "base/process/process_metrics.h" 8 #include "base/process/process_metrics.h"
9 #include "content/child/child_thread.h" 9 #include "content/child/child_thread_impl.h"
10 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
11 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 namespace { 15 namespace {
16 16
17 class ChildSharedBitmap : public SharedMemoryBitmap { 17 class ChildSharedBitmap : public SharedMemoryBitmap {
18 public: 18 public:
19 ChildSharedBitmap(scoped_refptr<ThreadSafeSender> sender, 19 ChildSharedBitmap(scoped_refptr<ThreadSafeSender> sender,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId(); 104 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
105 scoped_ptr<base::SharedMemory> memory; 105 scoped_ptr<base::SharedMemory> memory;
106 #if defined(OS_POSIX) 106 #if defined(OS_POSIX)
107 base::SharedMemoryHandle handle; 107 base::SharedMemoryHandle handle;
108 sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap( 108 sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap(
109 memory_size, id, &handle)); 109 memory_size, id, &handle));
110 memory = make_scoped_ptr(new base::SharedMemory(handle, false)); 110 memory = make_scoped_ptr(new base::SharedMemory(handle, false));
111 if (!memory->Map(memory_size)) 111 if (!memory->Map(memory_size))
112 CHECK(false); 112 CHECK(false);
113 #else 113 #else
114 memory = ChildThread::AllocateSharedMemory(memory_size, sender_.get()); 114 memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get());
115 #if defined(OS_WIN) 115 #if defined(OS_WIN)
116 if (!memory) 116 if (!memory)
117 CollectMemoryUsageAndDie(size); 117 CollectMemoryUsageAndDie(size);
118 #endif 118 #endif
119 119
120 CHECK(memory); 120 CHECK(memory);
121 if (!memory->Map(memory_size)) { 121 if (!memory->Map(memory_size)) {
122 #if defined(OS_WIN) 122 #if defined(OS_WIN)
123 CollectMemoryUsageAndDie(size); 123 CollectMemoryUsageAndDie(size);
124 #endif 124 #endif
(...skipping 21 matching lines...) Expand all
146 if (!mem->ShareToProcess(base::GetCurrentProcessHandle(), &handle_to_send)) 146 if (!mem->ShareToProcess(base::GetCurrentProcessHandle(), &handle_to_send))
147 return scoped_ptr<cc::SharedBitmap>(); 147 return scoped_ptr<cc::SharedBitmap>();
148 #endif 148 #endif
149 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap( 149 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap(
150 mem->mapped_size(), handle_to_send, id)); 150 mem->mapped_size(), handle_to_send, id));
151 151
152 return make_scoped_ptr(new ChildSharedBitmap(sender_, mem, id)); 152 return make_scoped_ptr(new ChildSharedBitmap(sender_, mem, id));
153 } 153 }
154 154
155 } // namespace content 155 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698