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

Side by Side Diff: content/renderer/gpu/command_buffer_proxy.cc

Issue 7634019: Allow cmdbuffer creation from compositor thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: weak ptr version 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 #include "content/renderer/gpu/command_buffer_proxy.h" 5 #include "content/renderer/gpu/command_buffer_proxy.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 LOG(ERROR) << "Send(GpuChannelMsg_CreateVideoDecoder) failed"; 401 LOG(ERROR) << "Send(GpuChannelMsg_CreateVideoDecoder) failed";
402 return NULL; 402 return NULL;
403 } 403 }
404 404
405 scoped_refptr<GpuVideoDecodeAcceleratorHost> decoder_host = 405 scoped_refptr<GpuVideoDecodeAcceleratorHost> decoder_host =
406 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); 406 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client);
407 bool inserted = video_decoder_hosts_.insert(std::make_pair( 407 bool inserted = video_decoder_hosts_.insert(std::make_pair(
408 decoder_route_id, decoder_host)).second; 408 decoder_route_id, decoder_host)).second;
409 DCHECK(inserted); 409 DCHECK(inserted);
410 410
411 channel_->AddRoute(decoder_route_id, decoder_host.get()); 411 channel_->AddRoute(decoder_route_id, decoder_host->AsWeakPtr());
412 412
413 return decoder_host; 413 return decoder_host;
414 } 414 }
415 415
416 #if defined(OS_MACOSX) 416 #if defined(OS_MACOSX)
417 void CommandBufferProxy::SetWindowSize(const gfx::Size& size) { 417 void CommandBufferProxy::SetWindowSize(const gfx::Size& size) {
418 if (last_state_.error != gpu::error::kNoError) 418 if (last_state_.error != gpu::error::kNoError)
419 return; 419 return;
420 420
421 Send(new GpuCommandBufferMsg_SetWindowSize(route_id_, size)); 421 Send(new GpuCommandBufferMsg_SetWindowSize(route_id_, size));
(...skipping 21 matching lines...) Expand all
443 delete msg; 443 delete msg;
444 return false; 444 return false;
445 } 445 }
446 446
447 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { 447 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) {
448 // Handle wraparound. It works as long as we don't have more than 2B state 448 // Handle wraparound. It works as long as we don't have more than 2B state
449 // updates in flight across which reordering occurs. 449 // updates in flight across which reordering occurs.
450 if (state.generation - last_state_.generation < 0x80000000U) 450 if (state.generation - last_state_.generation < 0x80000000U)
451 last_state_ = state; 451 last_state_ = state;
452 } 452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698