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

Unified Diff: cc/test/test_shared_bitmap_manager.cc

Issue 2909873002: Add cc::SharedBitmap::shared_memory_handle() (Closed)
Patch Set: fix tests Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/shared_bitmap.cc ('k') | components/viz/display_compositor/host_shared_bitmap_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_shared_bitmap_manager.cc
diff --git a/cc/test/test_shared_bitmap_manager.cc b/cc/test/test_shared_bitmap_manager.cc
index 604f669af5bbb643ef9aa3a94cf17182e62eed36..ca4b50f03d490ae227fd326aba1e735a97aa4f2e 100644
--- a/cc/test/test_shared_bitmap_manager.cc
+++ b/cc/test/test_shared_bitmap_manager.cc
@@ -12,6 +12,7 @@
namespace cc {
namespace {
+
class OwnedSharedBitmap : public SharedBitmap {
public:
OwnedSharedBitmap(std::unique_ptr<base::SharedMemory> shared_memory,
@@ -21,10 +22,26 @@ class OwnedSharedBitmap : public SharedBitmap {
~OwnedSharedBitmap() override {}
+ // SharedBitmap:
+ base::SharedMemoryHandle GetSharedMemoryHandle() const override {
+ return shared_memory_->handle();
+ }
+
private:
std::unique_ptr<base::SharedMemory> shared_memory_;
};
+class UnownedSharedBitmap : public SharedBitmap {
+ public:
+ UnownedSharedBitmap(uint8_t* pixels, const SharedBitmapId& id)
+ : SharedBitmap(pixels, id) {}
+
+ // SharedBitmap:
+ base::SharedMemoryHandle GetSharedMemoryHandle() const override {
+ return base::SharedMemoryHandle();
+ }
+};
+
} // namespace
TestSharedBitmapManager::TestSharedBitmapManager() {}
@@ -48,7 +65,7 @@ std::unique_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId(
if (bitmap_map_.find(id) == bitmap_map_.end())
return nullptr;
uint8_t* pixels = static_cast<uint8_t*>(bitmap_map_[id]->memory());
- return base::MakeUnique<SharedBitmap>(pixels, id);
+ return base::MakeUnique<UnownedSharedBitmap>(pixels, id);
}
} // namespace cc
« no previous file with comments | « cc/resources/shared_bitmap.cc ('k') | components/viz/display_compositor/host_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698