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

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

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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 | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/common/np_channel_base.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 "content/common/gpu/texture_image_transport_surface.h" 5 #include "content/common/gpu/texture_image_transport_surface.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 DCHECK(stub_destroyed_); 47 DCHECK(stub_destroyed_);
48 Destroy(); 48 Destroy();
49 } 49 }
50 50
51 bool TextureImageTransportSurface::Initialize() { 51 bool TextureImageTransportSurface::Initialize() {
52 mailbox_manager_ = 52 mailbox_manager_ =
53 helper_->stub()->decoder()->GetContextGroup()->mailbox_manager(); 53 helper_->stub()->decoder()->GetContextGroup()->mailbox_manager();
54 54
55 GpuChannelManager* manager = helper_->manager(); 55 GpuChannelManager* manager = helper_->manager();
56 surface_ = manager->GetDefaultOffscreenSurface(); 56 surface_ = manager->GetDefaultOffscreenSurface();
57 if (!surface_.get()) 57 if (!surface_)
58 return false; 58 return false;
59 59
60 if (!helper_->Initialize()) 60 if (!helper_->Initialize())
61 return false; 61 return false;
62 62
63 GpuChannel* parent_channel = manager->LookupChannel(handle_.parent_client_id); 63 GpuChannel* parent_channel = manager->LookupChannel(handle_.parent_client_id);
64 if (parent_channel) { 64 if (parent_channel) {
65 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 65 const CommandLine* command_line = CommandLine::ForCurrentProcess();
66 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) 66 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
67 helper_->SetPreemptByFlag(parent_channel->GetPreemptionFlag()); 67 helper_->SetPreemptByFlag(parent_channel->GetPreemptionFlag());
68 } 68 }
69 69
70 return true; 70 return true;
71 } 71 }
72 72
73 void TextureImageTransportSurface::Destroy() { 73 void TextureImageTransportSurface::Destroy() {
74 if (surface_.get()) 74 if (surface_)
75 surface_ = NULL; 75 surface_ = NULL;
76 76
77 helper_->Destroy(); 77 helper_->Destroy();
78 } 78 }
79 79
80 bool TextureImageTransportSurface::DeferDraws() { 80 bool TextureImageTransportSurface::DeferDraws() {
81 // The command buffer hit a draw/clear command that could clobber the 81 // The command buffer hit a draw/clear command that could clobber the
82 // texture in use by the UI compositor. If a Swap is pending, abort 82 // texture in use by the UI compositor. If a Swap is pending, abort
83 // processing of the command by returning true and unschedule until the Swap 83 // processing of the command by returning true and unschedule until the Swap
84 // Ack arrives. 84 // Ack arrives.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 mailbox_name.copy(reinterpret_cast<char *>(&mailbox_name_), 322 mailbox_name.copy(reinterpret_cast<char *>(&mailbox_name_),
323 sizeof(MailboxName)); 323 sizeof(MailboxName));
324 ConsumeTexture(); 324 ConsumeTexture();
325 } 325 }
326 326
327 if (stub_destroyed_ && backbuffer_->service_id()) { 327 if (stub_destroyed_ && backbuffer_->service_id()) {
328 // TODO(sievers): Remove this after changes to the mailbox to take ownership 328 // TODO(sievers): Remove this after changes to the mailbox to take ownership
329 // of the service ids. 329 // of the service ids.
330 DCHECK(context_.get() && surface_.get()); 330 DCHECK(context_.get() && surface_.get());
331 uint32 service_id = backbuffer_->ReleaseServiceId(); 331 uint32 service_id = backbuffer_->ReleaseServiceId();
332 if (context_->MakeCurrent(surface_.get())) 332 if (context_->MakeCurrent(surface_))
333 glDeleteTextures(1, &service_id); 333 glDeleteTextures(1, &service_id);
334 334
335 return; 335 return;
336 } 336 }
337 337
338 DCHECK(is_swap_buffers_pending_); 338 DCHECK(is_swap_buffers_pending_);
339 is_swap_buffers_pending_ = false; 339 is_swap_buffers_pending_ = false;
340 340
341 // We should not have allowed the backbuffer to be discarded while the ack 341 // We should not have allowed the backbuffer to be discarded while the ack
342 // was pending. 342 // was pending.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 GL_TEXTURE_2D, 495 GL_TEXTURE_2D,
496 mailbox_name_, 496 mailbox_name_,
497 backbuffer_.release(), 497 backbuffer_.release(),
498 NULL); 498 NULL);
499 DCHECK(success); 499 DCHECK(success);
500 mailbox_name_ = MailboxName(); 500 mailbox_name_ = MailboxName();
501 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0)); 501 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0));
502 } 502 }
503 503
504 } // namespace content 504 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/common/np_channel_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698