1 // Copyright 2014 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_TEST_TEST_SHARED_BITMAP_MANAGER_H_
6 #define COMPONENTS_VIZ_TEST_TEST_SHARED_BITMAP_MANAGER_H_
7 
8 #include <map>
9 #include <set>
10 
11 #include "base/memory/shared_memory_mapping.h"
12 #include "base/sequence_checker.h"
13 #include "components/viz/service/display/shared_bitmap_manager.h"
14 
15 namespace viz {
16 
17 class TestSharedBitmapManager : public SharedBitmapManager {
18  public:
19   TestSharedBitmapManager();
20   ~TestSharedBitmapManager() override;
21 
22   // SharedBitmapManager implementation.
23   std::unique_ptr<SharedBitmap> GetSharedBitmapFromId(
24       const gfx::Size& size,
25       ResourceFormat format,
26       const SharedBitmapId& id) override;
27   base::UnguessableToken GetSharedBitmapTracingGUIDFromId(
28       const SharedBitmapId& id) override;
29   bool ChildAllocatedSharedBitmap(base::ReadOnlySharedMemoryMapping mapping,
30                                   const SharedBitmapId& id) override;
31   void ChildDeletedSharedBitmap(const SharedBitmapId& id) override;
32 
33  private:
34   SEQUENCE_CHECKER(sequence_checker_);
35 
36   std::map<SharedBitmapId, base::ReadOnlySharedMemoryMapping> mapping_map_;
37   std::set<SharedBitmapId> notified_set_;
38 };
39 
40 }  // namespace viz
41 
42 #endif  // COMPONENTS_VIZ_TEST_TEST_SHARED_BITMAP_MANAGER_H_
43