OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/aura/context_factory_mojo.h" | 5 #include "mojo/aura/context_factory_mojo.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
10 #include "cc/output/software_output_device.h" | 10 #include "cc/output/software_output_device.h" |
11 #include "cc/resources/shared_bitmap_manager.h" | 11 #include "cc/resources/shared_bitmap_manager.h" |
| 12 #include "cc/surfaces/surface_id_allocator.h" |
12 #include "mojo/aura/window_tree_host_mojo.h" | 13 #include "mojo/aura/window_tree_host_mojo.h" |
13 #include "skia/ext/platform_canvas.h" | 14 #include "skia/ext/platform_canvas.h" |
14 #include "ui/compositor/reflector.h" | 15 #include "ui/compositor/reflector.h" |
15 | 16 |
16 namespace mojo { | 17 namespace mojo { |
17 namespace { | 18 namespace { |
18 | 19 |
19 void FreeSharedBitmap(cc::SharedBitmap* shared_bitmap) { | 20 void FreeSharedBitmap(cc::SharedBitmap* shared_bitmap) { |
20 delete shared_bitmap->memory(); | 21 delete shared_bitmap->memory(); |
21 } | 22 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 private: | 88 private: |
88 base::Lock lock_; | 89 base::Lock lock_; |
89 std::map<cc::SharedBitmapId, base::SharedMemory*> bitmap_map_; | 90 std::map<cc::SharedBitmapId, base::SharedMemory*> bitmap_map_; |
90 | 91 |
91 DISALLOW_COPY_AND_ASSIGN(TestSharedBitmapManager); | 92 DISALLOW_COPY_AND_ASSIGN(TestSharedBitmapManager); |
92 }; | 93 }; |
93 | 94 |
94 } // namespace | 95 } // namespace |
95 | 96 |
96 ContextFactoryMojo::ContextFactoryMojo() | 97 ContextFactoryMojo::ContextFactoryMojo() |
97 : shared_bitmap_manager_(new TestSharedBitmapManager()) { | 98 : shared_bitmap_manager_(new TestSharedBitmapManager()), |
| 99 next_surface_id_namespace_(1u) { |
98 } | 100 } |
99 | 101 |
100 ContextFactoryMojo::~ContextFactoryMojo() {} | 102 ContextFactoryMojo::~ContextFactoryMojo() {} |
101 | 103 |
102 scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface( | 104 scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface( |
103 ui::Compositor* compositor, | 105 ui::Compositor* compositor, |
104 bool software_fallback) { | 106 bool software_fallback) { |
105 scoped_ptr<cc::SoftwareOutputDevice> output_device( | 107 scoped_ptr<cc::SoftwareOutputDevice> output_device( |
106 new SoftwareOutputDeviceViewManager(compositor)); | 108 new SoftwareOutputDeviceViewManager(compositor)); |
107 return make_scoped_ptr(new cc::OutputSurface(output_device.Pass())); | 109 return make_scoped_ptr(new cc::OutputSurface(output_device.Pass())); |
(...skipping 19 matching lines...) Expand all Loading... |
127 bool ContextFactoryMojo::DoesCreateTestContexts() { return false; } | 129 bool ContextFactoryMojo::DoesCreateTestContexts() { return false; } |
128 | 130 |
129 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() { | 131 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() { |
130 return shared_bitmap_manager_.get(); | 132 return shared_bitmap_manager_.get(); |
131 } | 133 } |
132 | 134 |
133 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() { | 135 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() { |
134 return NULL; | 136 return NULL; |
135 } | 137 } |
136 | 138 |
| 139 scoped_ptr<cc::SurfaceIdAllocator> |
| 140 ContextFactoryMojo::CreateSurfaceIdAllocator() { |
| 141 return make_scoped_ptr( |
| 142 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
| 143 } |
| 144 |
137 } // namespace mojo | 145 } // namespace mojo |
OLD | NEW |