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

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

Issue 9194005: gpu: reference target surfaces through a globally unique surface id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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) 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 12 matching lines...) Expand all
23 GpuCommandBufferStub::GpuCommandBufferStub( 23 GpuCommandBufferStub::GpuCommandBufferStub(
24 GpuChannel* channel, 24 GpuChannel* channel,
25 GpuCommandBufferStub* share_group, 25 GpuCommandBufferStub* share_group,
26 gfx::PluginWindowHandle handle, 26 gfx::PluginWindowHandle handle,
27 const gfx::Size& size, 27 const gfx::Size& size,
28 const gpu::gles2::DisallowedFeatures& disallowed_features, 28 const gpu::gles2::DisallowedFeatures& disallowed_features,
29 const std::string& allowed_extensions, 29 const std::string& allowed_extensions,
30 const std::vector<int32>& attribs, 30 const std::vector<int32>& attribs,
31 gfx::GpuPreference gpu_preference, 31 gfx::GpuPreference gpu_preference,
32 int32 route_id, 32 int32 route_id,
33 int32 client_id, 33 int32 surface_id,
34 int32 render_view_id,
35 GpuWatchdog* watchdog, 34 GpuWatchdog* watchdog,
36 bool software) 35 bool software)
37 : channel_(channel), 36 : channel_(channel),
38 handle_(handle), 37 handle_(handle),
39 initial_size_(size), 38 initial_size_(size),
40 disallowed_features_(disallowed_features), 39 disallowed_features_(disallowed_features),
41 allowed_extensions_(allowed_extensions), 40 allowed_extensions_(allowed_extensions),
42 requested_attribs_(attribs), 41 requested_attribs_(attribs),
43 gpu_preference_(gpu_preference), 42 gpu_preference_(gpu_preference),
44 route_id_(route_id), 43 route_id_(route_id),
45 software_(software), 44 software_(software),
46 last_flush_count_(0), 45 last_flush_count_(0),
47 client_id_(client_id), 46 surface_id_(surface_id),
48 render_view_id_(render_view_id),
49 parent_stub_for_initialization_(), 47 parent_stub_for_initialization_(),
50 parent_texture_for_initialization_(0), 48 parent_texture_for_initialization_(0),
51 watchdog_(watchdog) { 49 watchdog_(watchdog) {
52 if (share_group) { 50 if (share_group) {
53 context_group_ = share_group->context_group_; 51 context_group_ = share_group->context_group_;
54 } else { 52 } else {
55 // TODO(gman): this needs to be false for everything but Pepper. 53 // TODO(gman): this needs to be false for everything but Pepper.
56 bool bind_generates_resource = true; 54 bool bind_generates_resource = true;
57 context_group_ = new gpu::gles2::ContextGroup(bind_generates_resource); 55 context_group_ = new gpu::gles2::ContextGroup(bind_generates_resource);
58 } 56 }
59 } 57 }
60 58
61 GpuCommandBufferStub::~GpuCommandBufferStub() { 59 GpuCommandBufferStub::~GpuCommandBufferStub() {
62 Destroy(); 60 Destroy();
63 61
64 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 62 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
65 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer( 63 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id_));
66 handle_, client_id_, render_view_id_));
67 } 64 }
68 65
69 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { 66 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
70 // Ensure the appropriate GL context is current before handling any IPC 67 // Ensure the appropriate GL context is current before handling any IPC
71 // messages directed at the command buffer. This ensures that the message 68 // messages directed at the command buffer. This ensures that the message
72 // handler can assume that the context is current. 69 // handler can assume that the context is current.
73 if (decoder_.get()) { 70 if (decoder_.get()) {
74 if (!decoder_->MakeCurrent()) { 71 if (!decoder_->MakeCurrent()) {
75 DLOG(ERROR) << "Context lost because MakeCurrent failed."; 72 DLOG(ERROR) << "Context lost because MakeCurrent failed.";
76 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 73 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 185 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
189 if (software_) { 186 if (software_) {
190 DLOG(ERROR) << "No software support.\n"; 187 DLOG(ERROR) << "No software support.\n";
191 OnInitializeFailed(reply_message); 188 OnInitializeFailed(reply_message);
192 return; 189 return;
193 } 190 }
194 #endif 191 #endif
195 192
196 surface_ = ImageTransportSurface::CreateSurface( 193 surface_ = ImageTransportSurface::CreateSurface(
197 channel_->gpu_channel_manager(), 194 channel_->gpu_channel_manager(),
198 render_view_id_, 195 this,
jonathan.backer 2012/01/16 19:47:26 Thanks for replacing the lookup with a WeakPtr.
199 client_id_,
200 route_id_,
201 handle_); 196 handle_);
202 } else { 197 } else {
203 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(software_, 198 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(software_,
204 gfx::Size(1, 1)); 199 gfx::Size(1, 1));
205 } 200 }
206 201
207 if (!surface_.get()) { 202 if (!surface_.get()) {
208 // Ensure the decoder is not destroyed if it is not initialized. 203 // Ensure the decoder is not destroyed if it is not initialized.
209 decoder_.reset(); 204 decoder_.reset();
210 205
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 GPUCommandBufferConsoleMessage console_message; 504 GPUCommandBufferConsoleMessage console_message;
510 console_message.id = id; 505 console_message.id = id;
511 console_message.message = message; 506 console_message.message = message;
512 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( 507 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg(
513 route_id_, console_message); 508 route_id_, console_message);
514 msg->set_unblock(true); 509 msg->set_unblock(true);
515 Send(msg); 510 Send(msg);
516 } 511 }
517 512
518 #endif // defined(ENABLE_GPU) 513 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698