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

Side by Side Diff: ui/compositor/test/in_process_context_factory.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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
10 #include "cc/surfaces/surface_id_allocator.h"
10 #include "cc/test/test_shared_bitmap_manager.h" 11 #include "cc/test/test_shared_bitmap_manager.h"
11 #include "ui/compositor/compositor_switches.h" 12 #include "ui/compositor/compositor_switches.h"
12 #include "ui/compositor/reflector.h" 13 #include "ui/compositor/reflector.h"
13 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
14 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
15 #include "webkit/common/gpu/context_provider_in_process.h" 16 #include "webkit/common/gpu/context_provider_in_process.h"
16 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" 17 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
17 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 18 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
18 19
19 namespace ui { 20 namespace ui {
20 21
21 InProcessContextFactory::InProcessContextFactory() 22 InProcessContextFactory::InProcessContextFactory()
22 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { 23 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()),
24 next_surface_id_namespace_(0) {
jamesr 2014/09/25 23:23:47 why does this one start at 0 but the mojo one star
23 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) 25 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone)
24 << "If running tests, ensure that main() is calling " 26 << "If running tests, ensure that main() is calling "
25 << "gfx::GLSurface::InitializeOneOffForTests()"; 27 << "gfx::GLSurface::InitializeOneOffForTests()";
26 28
27 #if defined(OS_CHROMEOS) 29 #if defined(OS_CHROMEOS)
28 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( 30 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kUIDisableThreadedCompositing); 31 switches::kUIDisableThreadedCompositing);
30 #else 32 #else
31 bool use_thread = false; 33 bool use_thread = false;
32 #endif 34 #endif
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { 97 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() {
96 return shared_bitmap_manager_.get(); 98 return shared_bitmap_manager_.get();
97 } 99 }
98 100
99 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { 101 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() {
100 if (!compositor_thread_) 102 if (!compositor_thread_)
101 return NULL; 103 return NULL;
102 return compositor_thread_->message_loop_proxy().get(); 104 return compositor_thread_->message_loop_proxy().get();
103 } 105 }
104 106
107 scoped_ptr<cc::SurfaceIdAllocator>
108 InProcessContextFactory::CreateSurfaceIdAllocator() {
109 return make_scoped_ptr(
110 new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
111 }
112
105 } // namespace ui 113 } // namespace ui
OLDNEW
« ui/compositor/compositor.cc ('K') | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698