1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_SHARED_BITMAP_MANAGER_H_
6 #define COMPONENTS_VIZ_SERVICE_DISPLAY_SHARED_BITMAP_MANAGER_H_
7 
8 #include <memory>
9 
10 #include "base/macros.h"
11 #include "base/memory/shared_memory_mapping.h"
12 #include "components/viz/common/resources/shared_bitmap.h"
13 
14 namespace gfx {
15 class Size;
16 }
17 
18 namespace viz {
19 
20 class SharedBitmapManager {
21  public:
SharedBitmapManager()22   SharedBitmapManager() {}
~SharedBitmapManager()23   virtual ~SharedBitmapManager() {}
24 
25   // Used in the display compositor to find the bitmap associated with an id.
26   virtual std::unique_ptr<SharedBitmap> GetSharedBitmapFromId(
27       const gfx::Size& size,
28       ResourceFormat format,
29       const SharedBitmapId& id) = 0;
30   virtual base::UnguessableToken GetSharedBitmapTracingGUIDFromId(
31       const SharedBitmapId& id) = 0;
32   // Used in the display compositor to associate an id to a shm mapping.
33   virtual bool ChildAllocatedSharedBitmap(
34       base::ReadOnlySharedMemoryMapping mapping,
35       const SharedBitmapId& id) = 0;
36   // Used in the display compositor to break an association of an id to a shm
37   // handle.
38   virtual void ChildDeletedSharedBitmap(const SharedBitmapId& id) = 0;
39 
40  private:
41   DISALLOW_COPY_AND_ASSIGN(SharedBitmapManager);
42 };
43 
44 }  // namespace viz
45 
46 #endif  // COMPONENTS_VIZ_SERVICE_DISPLAY_SHARED_BITMAP_MANAGER_H_
47