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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 7554015: Implemented support for GL constext share groups in the renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 11 matching lines...) Expand all
22 #if defined(OS_WIN) 22 #if defined(OS_WIN)
23 #include "base/win/wrapped_window_proc.h" 23 #include "base/win/wrapped_window_proc.h"
24 #elif defined(TOUCH_UI) 24 #elif defined(TOUCH_UI)
25 #include "content/common/gpu/image_transport_surface_linux.h" 25 #include "content/common/gpu/image_transport_surface_linux.h"
26 #endif 26 #endif
27 27
28 using gpu::Buffer; 28 using gpu::Buffer;
29 29
30 GpuCommandBufferStub::GpuCommandBufferStub( 30 GpuCommandBufferStub::GpuCommandBufferStub(
31 GpuChannel* channel, 31 GpuChannel* channel,
32 GpuCommandBufferStub* share_group,
32 gfx::PluginWindowHandle handle, 33 gfx::PluginWindowHandle handle,
33 const gfx::Size& size, 34 const gfx::Size& size,
34 const gpu::gles2::DisallowedExtensions& disallowed_extensions, 35 const gpu::gles2::DisallowedExtensions& disallowed_extensions,
35 const std::string& allowed_extensions, 36 const std::string& allowed_extensions,
36 const std::vector<int32>& attribs, 37 const std::vector<int32>& attribs,
37 int32 route_id, 38 int32 route_id,
38 int32 renderer_id, 39 int32 renderer_id,
39 int32 render_view_id, 40 int32 render_view_id,
40 GpuWatchdog* watchdog, 41 GpuWatchdog* watchdog,
41 bool software) 42 bool software)
42 : channel_(channel), 43 : channel_(channel),
43 handle_(handle), 44 handle_(handle),
44 initial_size_(size), 45 initial_size_(size),
45 disallowed_extensions_(disallowed_extensions), 46 disallowed_extensions_(disallowed_extensions),
46 allowed_extensions_(allowed_extensions), 47 allowed_extensions_(allowed_extensions),
47 requested_attribs_(attribs), 48 requested_attribs_(attribs),
48 route_id_(route_id), 49 route_id_(route_id),
49 software_(software), 50 software_(software),
50 last_flush_count_(0), 51 last_flush_count_(0),
51 renderer_id_(renderer_id), 52 renderer_id_(renderer_id),
52 render_view_id_(render_view_id), 53 render_view_id_(render_view_id),
53 parent_stub_for_initialization_(), 54 parent_stub_for_initialization_(),
54 parent_texture_for_initialization_(0), 55 parent_texture_for_initialization_(0),
55 watchdog_(watchdog), 56 watchdog_(watchdog),
56 task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 57 task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
58 if (share_group)
59 context_group_ = share_group->context_group_;
60 else
61 context_group_ = new gpu::gles2::ContextGroup;
57 } 62 }
58 63
59 GpuCommandBufferStub::~GpuCommandBufferStub() { 64 GpuCommandBufferStub::~GpuCommandBufferStub() {
60 if (scheduler_.get()) { 65 if (scheduler_.get()) {
61 scheduler_->Destroy(); 66 scheduler_->Destroy();
62 } 67 }
63 68
64 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 69 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
65 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer( 70 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(
66 handle_, renderer_id_, render_view_id_)); 71 handle_, renderer_id_, render_view_id_));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #else 145 #else
141 // POSIX receives a dup of the shared memory handle and closes the dup when 146 // POSIX receives a dup of the shared memory handle and closes the dup when
142 // this variable goes out of scope. 147 // this variable goes out of scope.
143 base::SharedMemory shared_memory(ring_buffer, false); 148 base::SharedMemory shared_memory(ring_buffer, false);
144 #endif 149 #endif
145 150
146 // Initialize the CommandBufferService and GpuScheduler. 151 // Initialize the CommandBufferService and GpuScheduler.
147 if (command_buffer_->Initialize(&shared_memory, size)) { 152 if (command_buffer_->Initialize(&shared_memory, size)) {
148 scheduler_.reset(gpu::GpuScheduler::Create(command_buffer_.get(), 153 scheduler_.reset(gpu::GpuScheduler::Create(command_buffer_.get(),
149 channel_, 154 channel_,
150 NULL)); 155 context_group_.get()));
151 #if defined(TOUCH_UI) 156 #if defined(TOUCH_UI)
152 if (software_) { 157 if (software_) {
153 OnInitializeFailed(reply_message); 158 OnInitializeFailed(reply_message);
154 return; 159 return;
155 } 160 }
156 161
157 scoped_refptr<gfx::GLSurface> surface; 162 scoped_refptr<gfx::GLSurface> surface;
158 if (handle_) 163 if (handle_)
159 surface = ImageTransportSurface::CreateSurface(this); 164 surface = ImageTransportSurface::CreateSurface(this);
160 else 165 else
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 new GpuVideoDecodeAccelerator(this, route_id_, this)); 558 new GpuVideoDecodeAccelerator(this, route_id_, this));
554 video_decoder_->Initialize(configs, reply_message); 559 video_decoder_->Initialize(configs, reply_message);
555 } 560 }
556 561
557 void GpuCommandBufferStub::OnDestroyVideoDecoder() { 562 void GpuCommandBufferStub::OnDestroyVideoDecoder() {
558 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; 563 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder";
559 video_decoder_.reset(); 564 video_decoder_.reset();
560 } 565 }
561 566
562 #endif // defined(ENABLE_GPU) 567 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698