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

Side by Side Diff: gpu/demos/framework/window.cc

Issue 9699048: Make Occlusion Query Sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make it more C++y Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « gpu/demos/framework/window.h ('k') | gpu/demos/framework/window_linux.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/demos/framework/window.h" 5 #include "gpu/demos/framework/window.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 29
30 namespace gpu { 30 namespace gpu {
31 namespace demos { 31 namespace demos {
32 32
33 Window::Window() 33 Window::Window()
34 : window_handle_(NULL), 34 : window_handle_(NULL),
35 demo_(CreateDemo()) { 35 demo_(CreateDemo()) {
36 } 36 }
37 37
38 Window::~Window() { 38 Window::~Window() {
39 demo_.reset();
40
41 // must free client before service.
42 gles2_implementation_.reset();
43 transfer_buffer_.reset();
44 gles2_cmd_helper_.reset();
45
39 if (decoder_.get()) { 46 if (decoder_.get()) {
40 decoder_->Destroy(); 47 decoder_->Destroy();
41 } 48 }
42 } 49 }
43 50
44 bool Window::Init(int width, int height) { 51 bool Window::Init(int width, int height) {
45 window_handle_ = CreateNativeWindow(demo_->Title(), width, height); 52 window_handle_ = CreateNativeWindow(demo_->Title(), width, height);
46 if (window_handle_ == NULL) 53 if (window_handle_ == NULL)
47 return false; 54 return false;
48 if (!CreateRenderContext(PluginWindow(window_handle_))) 55 if (!CreateRenderContext(PluginWindow(window_handle_)))
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 base::Bind(&GpuScheduler::SetGetBuffer, 108 base::Bind(&GpuScheduler::SetGetBuffer,
102 base::Unretained(gpu_scheduler_.get()))); 109 base::Unretained(gpu_scheduler_.get())));
103 110
104 gles2_cmd_helper_.reset(new GLES2CmdHelper(command_buffer_.get())); 111 gles2_cmd_helper_.reset(new GLES2CmdHelper(command_buffer_.get()));
105 if (!gles2_cmd_helper_->Initialize(kCommandBufferSize)) 112 if (!gles2_cmd_helper_->Initialize(kCommandBufferSize))
106 return false; 113 return false;
107 114
108 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_cmd_helper_.get())); 115 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_cmd_helper_.get()));
109 116
110 ::gles2::Initialize(); 117 ::gles2::Initialize();
111 GLES2Implementation* gles2_implementation = new GLES2Implementation( 118 gles2_implementation_.reset(new GLES2Implementation(
112 gles2_cmd_helper_.get(), 119 gles2_cmd_helper_.get(),
113 transfer_buffer_.get(), 120 transfer_buffer_.get(),
114 false, 121 false,
115 true); 122 true));
116 123
117 ::gles2::SetGLContext(gles2_implementation); 124 ::gles2::SetGLContext(gles2_implementation_.get());
118 125
119 if (!gles2_implementation->Initialize( 126 if (!gles2_implementation_->Initialize(
120 kTransferBufferSize, 127 kTransferBufferSize,
121 kTransferBufferSize, 128 kTransferBufferSize,
122 kTransferBufferSize)) { 129 kTransferBufferSize)) {
123 return false; 130 return false;
124 } 131 }
125 132
126 return true; 133 return true;
127 } 134 }
128 135
129 } // namespace demos 136 } // namespace demos
130 } // namespace gpu 137 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/demos/framework/window.h ('k') | gpu/demos/framework/window_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698