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

Side by Side Diff: components/viz/service/display_embedder/shared_bitmap_allocation_notifier_impl.cc

Issue 2965103003: Test
Patch Set: c Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/viz/service/display_embedder/shared_bitmap_allocation_notif ier_impl.h" 5 #include "components/viz/service/display_embedder/shared_bitmap_allocation_notif ier_impl.h"
6 6
7 #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h " 7 #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h "
8 #include "mojo/public/cpp/system/platform_handle.h" 8 #include "mojo/public/cpp/system/platform_handle.h"
9 9
10 namespace viz { 10 namespace viz {
11 11
12 SharedBitmapAllocationNotifierImpl::SharedBitmapAllocationNotifierImpl( 12 SharedBitmapAllocationNotifierImpl::SharedBitmapAllocationNotifierImpl(
13 ServerSharedBitmapManager* manager) 13 ServerSharedBitmapManager* manager)
14 : manager_(manager), binding_(this) {} 14 : manager_(manager), binding_(this) {}
15 15
16 SharedBitmapAllocationNotifierImpl::~SharedBitmapAllocationNotifierImpl() { 16 SharedBitmapAllocationNotifierImpl::~SharedBitmapAllocationNotifierImpl() {
17 for (const auto& id : owned_bitmaps_) 17 for (const auto& id : owned_bitmaps_)
18 manager_->ChildDeletedSharedBitmap(id); 18 manager_->ChildDeletedSharedBitmap(id);
19 } 19 }
20 20
21 void SharedBitmapAllocationNotifierImpl::Bind( 21 void SharedBitmapAllocationNotifierImpl::Bind(
22 cc::mojom::SharedBitmapAllocationNotifierAssociatedRequest request) { 22 cc::mojom::SharedBitmapAllocationNotifierAssociatedRequest request) {
23 binding_.Bind(std::move(request)); 23 binding_.Bind(std::move(request));
24 } 24 }
25 25
26 void SharedBitmapAllocationNotifierImpl::DidAllocateSharedBitmap( 26 void SharedBitmapAllocationNotifierImpl::DidAllocateSharedBitmap(
27 mojo::ScopedSharedBufferHandle buffer, 27 mojo::ScopedSharedBufferHandle buffer,
28 const cc::SharedBitmapId& id) { 28 const cc::SharedBitmapId& id) {
29 return;
29 base::SharedMemoryHandle memory_handle; 30 base::SharedMemoryHandle memory_handle;
30 size_t size; 31 size_t size;
31 MojoResult result = mojo::UnwrapSharedMemoryHandle( 32 MojoResult result = mojo::UnwrapSharedMemoryHandle(
32 std::move(buffer), &memory_handle, &size, NULL); 33 std::move(buffer), &memory_handle, &size, NULL);
33 DCHECK_EQ(result, MOJO_RESULT_OK); 34 DCHECK_EQ(result, MOJO_RESULT_OK);
34 this->ChildAllocatedSharedBitmap(size, memory_handle, id); 35 this->ChildAllocatedSharedBitmap(size, memory_handle, id);
35 } 36 }
36 37
37 void SharedBitmapAllocationNotifierImpl::DidDeleteSharedBitmap( 38 void SharedBitmapAllocationNotifierImpl::DidDeleteSharedBitmap(
38 const cc::SharedBitmapId& id) { 39 const cc::SharedBitmapId& id) {
39 manager_->ChildDeletedSharedBitmap(id); 40 manager_->ChildDeletedSharedBitmap(id);
40 owned_bitmaps_.erase(id); 41 owned_bitmaps_.erase(id);
41 } 42 }
42 43
43 void SharedBitmapAllocationNotifierImpl::ChildAllocatedSharedBitmap( 44 void SharedBitmapAllocationNotifierImpl::ChildAllocatedSharedBitmap(
44 size_t buffer_size, 45 size_t buffer_size,
45 const base::SharedMemoryHandle& handle, 46 const base::SharedMemoryHandle& handle,
46 const cc::SharedBitmapId& id) { 47 const cc::SharedBitmapId& id) {
47 if (manager_->ChildAllocatedSharedBitmap(buffer_size, handle, id)) 48 if (manager_->ChildAllocatedSharedBitmap(buffer_size, handle, id))
48 owned_bitmaps_.insert(id); 49 owned_bitmaps_.insert(id);
49 } 50 }
50 51
51 } // namespace viz 52 } // namespace viz
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698