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

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

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (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
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 "cc/output/output_surface.h" 8 #include "cc/output/output_surface.h"
9 #include "cc/output/software_output_device.h" 9 #include "cc/output/software_output_device.h"
10 #include "cc/resources/shared_bitmap_manager.h" 10 #include "cc/resources/shared_bitmap_manager.h"
11 #include "cc/surfaces/surface_id_allocator.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 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_;
89 90
90 DISALLOW_COPY_AND_ASSIGN(TestSharedBitmapManager); 91 DISALLOW_COPY_AND_ASSIGN(TestSharedBitmapManager);
91 }; 92 };
92 93
93 } // namespace 94 } // namespace
94 95
95 ContextFactoryMojo::ContextFactoryMojo() 96 ContextFactoryMojo::ContextFactoryMojo()
96 : shared_bitmap_manager_(new TestSharedBitmapManager()) { 97 : shared_bitmap_manager_(new TestSharedBitmapManager()),
98 next_surface_id_namespace_(1u) {
97 } 99 }
98 100
99 ContextFactoryMojo::~ContextFactoryMojo() {} 101 ContextFactoryMojo::~ContextFactoryMojo() {}
100 102
101 scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface( 103 scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface(
102 ui::Compositor* compositor, 104 ui::Compositor* compositor,
103 bool software_fallback) { 105 bool software_fallback) {
104 scoped_ptr<cc::SoftwareOutputDevice> output_device( 106 scoped_ptr<cc::SoftwareOutputDevice> output_device(
105 new SoftwareOutputDeviceViewManager(compositor)); 107 new SoftwareOutputDeviceViewManager(compositor));
106 return make_scoped_ptr(new cc::OutputSurface(output_device.Pass())); 108 return make_scoped_ptr(new cc::OutputSurface(output_device.Pass()));
(...skipping 19 matching lines...) Expand all
126 bool ContextFactoryMojo::DoesCreateTestContexts() { return false; } 128 bool ContextFactoryMojo::DoesCreateTestContexts() { return false; }
127 129
128 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() { 130 cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() {
129 return shared_bitmap_manager_.get(); 131 return shared_bitmap_manager_.get();
130 } 132 }
131 133
132 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() { 134 base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() {
133 return NULL; 135 return NULL;
134 } 136 }
135 137
138 scoped_ptr<cc::SurfaceIdAllocator>
139 ContextFactoryMojo::CreateSurfaceIdAllocator() {
140 return make_scoped_ptr(
141 new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
142 }
143
136 } // namespace mojo 144 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698