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

Side by Side Diff: mojo/aura/context_factory_mojo.cc

Issue 623573002: Mojo: Convert the remaining OVERRIDEs to override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « mojo/aura/context_factory_mojo.h ('k') | mojo/aura/screen_mojo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
9 #include "cc/output/software_output_device.h" 10 #include "cc/output/software_output_device.h"
10 #include "cc/resources/shared_bitmap_manager.h" 11 #include "cc/resources/shared_bitmap_manager.h"
11 #include "mojo/aura/window_tree_host_mojo.h" 12 #include "mojo/aura/window_tree_host_mojo.h"
12 #include "skia/ext/platform_canvas.h" 13 #include "skia/ext/platform_canvas.h"
13 #include "ui/compositor/reflector.h" 14 #include "ui/compositor/reflector.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 namespace { 17 namespace {
17 18
18 void FreeSharedBitmap(cc::SharedBitmap* shared_bitmap) { 19 void FreeSharedBitmap(cc::SharedBitmap* shared_bitmap) {
19 delete shared_bitmap->memory(); 20 delete shared_bitmap->memory();
20 } 21 }
21 22
22 void IgnoreSharedBitmap(cc::SharedBitmap* shared_bitmap) {} 23 void IgnoreSharedBitmap(cc::SharedBitmap* shared_bitmap) {}
23 24
24 class SoftwareOutputDeviceViewManager : public cc::SoftwareOutputDevice { 25 class SoftwareOutputDeviceViewManager : public cc::SoftwareOutputDevice {
25 public: 26 public:
26 explicit SoftwareOutputDeviceViewManager(ui::Compositor* compositor) 27 explicit SoftwareOutputDeviceViewManager(ui::Compositor* compositor)
27 : compositor_(compositor) { 28 : compositor_(compositor) {
28 } 29 }
29 virtual ~SoftwareOutputDeviceViewManager() {} 30 virtual ~SoftwareOutputDeviceViewManager() {}
30 31
31 // cc::SoftwareOutputDevice: 32 // cc::SoftwareOutputDevice:
32 virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE { 33 virtual void EndPaint(cc::SoftwareFrameData* frame_data) override {
33 WindowTreeHostMojo* window_tree_host = 34 WindowTreeHostMojo* window_tree_host =
34 WindowTreeHostMojo::ForCompositor(compositor_); 35 WindowTreeHostMojo::ForCompositor(compositor_);
35 DCHECK(window_tree_host); 36 DCHECK(window_tree_host);
36 window_tree_host->SetContents( 37 window_tree_host->SetContents(
37 skia::GetTopDevice(*canvas_)->accessBitmap(true)); 38 skia::GetTopDevice(*canvas_)->accessBitmap(true));
38 39
39 SoftwareOutputDevice::EndPaint(frame_data); 40 SoftwareOutputDevice::EndPaint(frame_data);
40 } 41 }
41 42
42 private: 43 private:
43 ui::Compositor* compositor_; 44 ui::Compositor* compositor_;
44 45
45 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceViewManager); 46 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceViewManager);
46 }; 47 };
47 48
48 // TODO(sky): this is a copy from cc/test. Copy to a common place. 49 // TODO(sky): this is a copy from cc/test. Copy to a common place.
49 class TestSharedBitmapManager : public cc::SharedBitmapManager { 50 class TestSharedBitmapManager : public cc::SharedBitmapManager {
50 public: 51 public:
51 TestSharedBitmapManager() {} 52 TestSharedBitmapManager() {}
52 virtual ~TestSharedBitmapManager() {} 53 virtual ~TestSharedBitmapManager() {}
53 54
54 virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap( 55 virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap(
55 const gfx::Size& size) OVERRIDE { 56 const gfx::Size& size) override {
56 base::AutoLock lock(lock_); 57 base::AutoLock lock(lock_);
57 scoped_ptr<base::SharedMemory> memory(new base::SharedMemory); 58 scoped_ptr<base::SharedMemory> memory(new base::SharedMemory);
58 memory->CreateAndMapAnonymous(size.GetArea() * 4); 59 memory->CreateAndMapAnonymous(size.GetArea() * 4);
59 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId(); 60 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
60 bitmap_map_[id] = memory.get(); 61 bitmap_map_[id] = memory.get();
61 return scoped_ptr<cc::SharedBitmap>( 62 return scoped_ptr<cc::SharedBitmap>(
62 new cc::SharedBitmap(memory.release(), id, 63 new cc::SharedBitmap(memory.release(), id,
63 base::Bind(&FreeSharedBitmap))); 64 base::Bind(&FreeSharedBitmap)));
64 } 65 }
65 66
66 virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId( 67 virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
67 const gfx::Size&, 68 const gfx::Size&,
68 const cc::SharedBitmapId& id) OVERRIDE { 69 const cc::SharedBitmapId& id) override {
69 base::AutoLock lock(lock_); 70 base::AutoLock lock(lock_);
70 if (bitmap_map_.find(id) == bitmap_map_.end()) 71 if (bitmap_map_.find(id) == bitmap_map_.end())
71 return scoped_ptr<cc::SharedBitmap>(); 72 return scoped_ptr<cc::SharedBitmap>();
72 return scoped_ptr<cc::SharedBitmap>( 73 return scoped_ptr<cc::SharedBitmap>(
73 new cc::SharedBitmap(bitmap_map_[id], id, 74 new cc::SharedBitmap(bitmap_map_[id], id,
74 base::Bind(&IgnoreSharedBitmap))); 75 base::Bind(&IgnoreSharedBitmap)));
75 } 76 }
76 77
77 virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory( 78 virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
78 base::SharedMemory* memory) OVERRIDE { 79 base::SharedMemory* memory) override {
79 base::AutoLock lock(lock_); 80 base::AutoLock lock(lock_);
80 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId(); 81 cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
81 bitmap_map_[id] = memory; 82 bitmap_map_[id] = memory;
82 return scoped_ptr<cc::SharedBitmap>( 83 return scoped_ptr<cc::SharedBitmap>(
83 new cc::SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap))); 84 new cc::SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap)));
84 } 85 }
85 86
86 private: 87 private:
87 base::Lock lock_; 88 base::Lock lock_;
88 std::map<cc::SharedBitmapId, base::SharedMemory*> bitmap_map_; 89 std::map<cc::SharedBitmapId, base::SharedMemory*> bitmap_map_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() { 129 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() {
129 return shared_bitmap_manager_.get(); 130 return shared_bitmap_manager_.get();
130 } 131 }
131 132
132 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() { 133 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() {
133 return NULL; 134 return NULL;
134 } 135 }
135 136
136 } // namespace mojo 137 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/aura/context_factory_mojo.h ('k') | mojo/aura/screen_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698