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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 1322853005: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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/client/command_buffer_proxy_impl.h" 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 27 matching lines...) Expand all
38 last_put_offset_(-1), 38 last_put_offset_(-1),
39 last_barrier_put_offset_(-1), 39 last_barrier_put_offset_(-1),
40 next_signal_id_(0) { 40 next_signal_id_(0) {
41 DCHECK(channel); 41 DCHECK(channel);
42 } 42 }
43 43
44 CommandBufferProxyImpl::~CommandBufferProxyImpl() { 44 CommandBufferProxyImpl::~CommandBufferProxyImpl() {
45 FOR_EACH_OBSERVER(DeletionObserver, 45 FOR_EACH_OBSERVER(DeletionObserver,
46 deletion_observers_, 46 deletion_observers_,
47 OnWillDeleteImpl()); 47 OnWillDeleteImpl());
48 if (channel_) { 48 Destroy();
49 channel_->DestroyCommandBuffer(this); 49 }
50 channel_ = nullptr; 50
51 } 51 void CommandBufferProxyImpl::Destroy() {
piman 2015/09/09 19:14:22 The lock needs to be held here. Should this CheckL
52 if (!channel_)
53 return;
54
55 channel_->DestroyCommandBuffer(this);
Ken Russell (switch to Gerrit) 2015/09/09 06:09:11 Doesn't DestroyCommandBuffer need to be called on
reveman 2015/09/09 13:45:23 Correct. ::Destroy has the same thread usage restr
56 channel_ = nullptr;
57 last_state_.error = gpu::error::kLostContext;
piman 2015/09/09 19:14:22 If we lose the context, we have to lose all contex
58 last_state_.context_lost_reason = gpu::error::kGpuChannelLost;
52 } 59 }
53 60
54 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { 61 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) {
55 scoped_ptr<base::AutoLock> lock; 62 scoped_ptr<base::AutoLock> lock;
56 if (lock_) 63 if (lock_)
57 lock.reset(new base::AutoLock(*lock_)); 64 lock.reset(new base::AutoLock(*lock_));
58 bool handled = true; 65 bool handled = true;
59 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) 66 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message)
60 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); 67 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed);
61 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); 68 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 647 }
641 } 648 }
642 649
643 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, 650 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase,
644 base::TimeDelta interval) { 651 base::TimeDelta interval) {
645 if (!update_vsync_parameters_completion_callback_.is_null()) 652 if (!update_vsync_parameters_completion_callback_.is_null())
646 update_vsync_parameters_completion_callback_.Run(timebase, interval); 653 update_vsync_parameters_completion_callback_.Run(timebase, interval);
647 } 654 }
648 655
649 } // namespace content 656 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698