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

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

Issue 234033002: CHECK that shared bitmap was mapped on POSIX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/child/child_thread.h" 7 #include "content/child/child_thread.h"
8 #include "content/common/child_process_messages.h" 8 #include "content/common/child_process_messages.h"
9 #include "ui/gfx/size.h" 9 #include "ui/gfx/size.h"
10 10
(...skipping 16 matching lines...) Expand all
27 size_t memory_size; 27 size_t memory_size;
28 if (!cc::SharedBitmap::SizeInBytes(size, &memory_size)) 28 if (!cc::SharedBitmap::SizeInBytes(size, &memory_size))
29 return scoped_ptr<cc::SharedBitmap>(); 29 return scoped_ptr<cc::SharedBitmap>();
30 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId(); 30 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
31 scoped_ptr<base::SharedMemory> memory; 31 scoped_ptr<base::SharedMemory> memory;
32 #if defined(OS_POSIX) 32 #if defined(OS_POSIX)
33 base::SharedMemoryHandle handle; 33 base::SharedMemoryHandle handle;
34 sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap( 34 sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap(
35 memory_size, id, &handle)); 35 memory_size, id, &handle));
36 memory = make_scoped_ptr(new base::SharedMemory(handle, false)); 36 memory = make_scoped_ptr(new base::SharedMemory(handle, false));
37 memory->Map(memory_size); 37 CHECK(memory->Map(memory_size));
38 #else 38 #else
39 memory.reset(ChildThread::AllocateSharedMemory(memory_size, sender_)); 39 memory.reset(ChildThread::AllocateSharedMemory(memory_size, sender_));
40 CHECK(memory); 40 CHECK(memory);
41 base::SharedMemoryHandle handle_to_send = memory->handle(); 41 base::SharedMemoryHandle handle_to_send = memory->handle();
42 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap( 42 sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap(
43 memory_size, handle_to_send, id)); 43 memory_size, handle_to_send, id));
44 #endif 44 #endif
45 // The compositor owning the SharedBitmap will be closed before the 45 // The compositor owning the SharedBitmap will be closed before the
46 // ChildThread containng this, making the use of base::Unretained safe. 46 // ChildThread containng this, making the use of base::Unretained safe.
47 return scoped_ptr<cc::SharedBitmap>(new cc::SharedBitmap( 47 return scoped_ptr<cc::SharedBitmap>(new cc::SharedBitmap(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 sender_->Send(new ChildProcessHostMsg_DeletedSharedBitmap(bitmap->id())); 82 sender_->Send(new ChildProcessHostMsg_DeletedSharedBitmap(bitmap->id()));
83 delete bitmap->memory(); 83 delete bitmap->memory();
84 } 84 }
85 85
86 void ChildSharedBitmapManager::ReleaseSharedBitmap(cc::SharedBitmap* handle) { 86 void ChildSharedBitmapManager::ReleaseSharedBitmap(cc::SharedBitmap* handle) {
87 TRACE_EVENT0("renderer", "ChildSharedBitmapManager::ReleaseSharedBitmap"); 87 TRACE_EVENT0("renderer", "ChildSharedBitmapManager::ReleaseSharedBitmap");
88 sender_->Send(new ChildProcessHostMsg_DeletedSharedBitmap(handle->id())); 88 sender_->Send(new ChildProcessHostMsg_DeletedSharedBitmap(handle->id()));
89 } 89 }
90 90
91 } // namespace content 91 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698