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

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

Issue 2488913003: Replacing allocate bitmap IPC messages with a new Mojo interface. (Closed)
Patch Set: Clean-up Created 4 years, 1 month 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 #ifndef CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ 5 #ifndef CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_
6 #define CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ 6 #define CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/shared_memory.h" 14 #include "base/memory/shared_memory.h"
15 #include "cc/resources/shared_bitmap_manager.h" 15 #include "cc/resources/shared_bitmap_manager.h"
16 #include "content/child/thread_safe_sender.h" 16 #include "content/child/thread_safe_sender.h"
17 #include "content/common/shared_memory_allocator.mojom.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class SharedMemoryBitmap : public cc::SharedBitmap { 21 class SharedMemoryBitmap : public cc::SharedBitmap {
21 public: 22 public:
22 base::SharedMemory* shared_memory() { return shared_memory_; } 23 base::SharedMemory* shared_memory() { return shared_memory_; }
23 24
24 protected: 25 protected:
25 SharedMemoryBitmap(uint8_t* pixels, 26 SharedMemoryBitmap(uint8_t* pixels,
26 const cc::SharedBitmapId& id, 27 const cc::SharedBitmapId& id,
27 base::SharedMemory* shared_memory); 28 base::SharedMemory* shared_memory);
28 29
29 base::SharedMemory* shared_memory_; 30 base::SharedMemory* shared_memory_;
30 }; 31 };
31 32
32 class ChildSharedBitmapManager : public cc::SharedBitmapManager { 33 class ChildSharedBitmapManager : public cc::SharedBitmapManager {
33 public: 34 public:
34 ChildSharedBitmapManager(scoped_refptr<ThreadSafeSender> sender); 35 ChildSharedBitmapManager(
36 scoped_refptr<ThreadSafeSender> sender,
37 mojom::SharedMemoryAllocatorPtr shared_memory_allocator);
35 ~ChildSharedBitmapManager() override; 38 ~ChildSharedBitmapManager() override;
36 39
37 // cc::SharedBitmapManager implementation. 40 // cc::SharedBitmapManager implementation.
38 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap( 41 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap(
39 const gfx::Size& size) override; 42 const gfx::Size& size) override;
40 std::unique_ptr<cc::SharedBitmap> GetSharedBitmapFromId( 43 std::unique_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
41 const gfx::Size&, 44 const gfx::Size&,
42 const cc::SharedBitmapId&) override; 45 const cc::SharedBitmapId&) override;
43 46
44 std::unique_ptr<cc::SharedBitmap> GetBitmapForSharedMemory( 47 std::unique_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
45 base::SharedMemory* mem); 48 base::SharedMemory* mem);
46 std::unique_ptr<SharedMemoryBitmap> AllocateSharedMemoryBitmap( 49 std::unique_ptr<SharedMemoryBitmap> AllocateSharedMemoryBitmap(
47 const gfx::Size& size); 50 const gfx::Size& size);
48 51
52 void OnBitmapDeleted(const cc::SharedBitmapId& id);
53
49 private: 54 private:
55 void FinishInitialization();
56
57 void NotifyAllocatedSharedBitmap(
58 base::SharedMemory* memory,
59 const cc::SharedBitmapId& id);
60
50 scoped_refptr<ThreadSafeSender> sender_; 61 scoped_refptr<ThreadSafeSender> sender_;
51 62
63 mojom::SharedMemoryAllocatorPtrInfo shared_memory_allocator_ptr_info_;
64 mojom::SharedMemoryAllocatorPtr shared_memory_allocator_;
65
66 base::WeakPtrFactory<ChildSharedBitmapManager> weak_factory_;
67
52 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager); 68 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager);
53 }; 69 };
54 70
55 } // namespace content 71 } // namespace content
56 72
57 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ 73 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698