OLD | NEW |
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(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 bool future_sync_points) | 76 bool future_sync_points) |
77 : preemption_state_(IDLE), | 77 : preemption_state_(IDLE), |
78 gpu_channel_(gpu_channel), | 78 gpu_channel_(gpu_channel), |
79 sender_(NULL), | 79 sender_(NULL), |
80 sync_point_manager_(sync_point_manager), | 80 sync_point_manager_(sync_point_manager), |
81 message_loop_(message_loop), | 81 message_loop_(message_loop), |
82 messages_forwarded_to_channel_(0), | 82 messages_forwarded_to_channel_(0), |
83 a_stub_is_descheduled_(false), | 83 a_stub_is_descheduled_(false), |
84 future_sync_points_(future_sync_points) {} | 84 future_sync_points_(future_sync_points) {} |
85 | 85 |
86 virtual void OnFilterAdded(IPC::Sender* sender) override { | 86 void OnFilterAdded(IPC::Sender* sender) override { |
87 DCHECK(!sender_); | 87 DCHECK(!sender_); |
88 sender_ = sender; | 88 sender_ = sender; |
89 } | 89 } |
90 | 90 |
91 virtual void OnFilterRemoved() override { | 91 void OnFilterRemoved() override { |
92 DCHECK(sender_); | 92 DCHECK(sender_); |
93 sender_ = NULL; | 93 sender_ = NULL; |
94 } | 94 } |
95 | 95 |
96 virtual bool OnMessageReceived(const IPC::Message& message) override { | 96 bool OnMessageReceived(const IPC::Message& message) override { |
97 DCHECK(sender_); | 97 DCHECK(sender_); |
98 | 98 |
99 bool handled = false; | 99 bool handled = false; |
100 if ((message.type() == GpuCommandBufferMsg_RetireSyncPoint::ID) && | 100 if ((message.type() == GpuCommandBufferMsg_RetireSyncPoint::ID) && |
101 !future_sync_points_) { | 101 !future_sync_points_) { |
102 DLOG(ERROR) << "Untrusted client should not send " | 102 DLOG(ERROR) << "Untrusted client should not send " |
103 "GpuCommandBufferMsg_RetireSyncPoint message"; | 103 "GpuCommandBufferMsg_RetireSyncPoint message"; |
104 return true; | 104 return true; |
105 } | 105 } |
106 | 106 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void UpdateStubSchedulingState(bool a_stub_is_descheduled) { | 159 void UpdateStubSchedulingState(bool a_stub_is_descheduled) { |
160 a_stub_is_descheduled_ = a_stub_is_descheduled; | 160 a_stub_is_descheduled_ = a_stub_is_descheduled; |
161 UpdatePreemptionState(); | 161 UpdatePreemptionState(); |
162 } | 162 } |
163 | 163 |
164 bool Send(IPC::Message* message) { | 164 bool Send(IPC::Message* message) { |
165 return sender_->Send(message); | 165 return sender_->Send(message); |
166 } | 166 } |
167 | 167 |
168 protected: | 168 protected: |
169 virtual ~GpuChannelMessageFilter() {} | 169 ~GpuChannelMessageFilter() override {} |
170 | 170 |
171 private: | 171 private: |
172 enum PreemptionState { | 172 enum PreemptionState { |
173 // Either there's no other channel to preempt, there are no messages | 173 // Either there's no other channel to preempt, there are no messages |
174 // pending processing, or we just finished preempting and have to wait | 174 // pending processing, or we just finished preempting and have to wait |
175 // before preempting again. | 175 // before preempting again. |
176 IDLE, | 176 IDLE, |
177 // We are waiting kPreemptWaitTimeMs before checking if we should preempt. | 177 // We are waiting kPreemptWaitTimeMs before checking if we should preempt. |
178 WAITING, | 178 WAITING, |
179 // We can preempt whenever any IPC processing takes more than | 179 // We can preempt whenever any IPC processing takes more than |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 uint64 GpuChannel::GetMemoryUsage() { | 812 uint64 GpuChannel::GetMemoryUsage() { |
813 uint64 size = 0; | 813 uint64 size = 0; |
814 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); | 814 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
815 !it.IsAtEnd(); it.Advance()) { | 815 !it.IsAtEnd(); it.Advance()) { |
816 size += it.GetCurrentValue()->GetMemoryUsage(); | 816 size += it.GetCurrentValue()->GetMemoryUsage(); |
817 } | 817 } |
818 return size; | 818 return size; |
819 } | 819 } |
820 | 820 |
821 } // namespace content | 821 } // namespace content |
OLD | NEW |