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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 | 397 |
398 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); | 398 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); |
399 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 399 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
400 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); | 400 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); |
401 } | 401 } |
402 | 402 |
403 GpuChannel::~GpuChannel() { | 403 GpuChannel::~GpuChannel() { |
404 STLDeleteElements(&deferred_messages_); | 404 STLDeleteElements(&deferred_messages_); |
405 if (preempting_flag_.get()) | 405 if (preempting_flag_.get()) |
406 preempting_flag_->Reset(); | 406 preempting_flag_->Reset(); |
407 | |
408 bool have_context = gfx::GLContext::GetCurrent()->IsCurrent(NULL); | |
409 if (image_manager_) | |
410 image_manager_->Destroy(have_context); | |
reveman
2014/06/03 15:57:54
I don't think this will work. What if the context
sohanjg
2014/06/04 06:39:02
I have tried checking the context from GpuCommandB
| |
407 } | 411 } |
408 | 412 |
409 void GpuChannel::Init(base::MessageLoopProxy* io_message_loop, | 413 void GpuChannel::Init(base::MessageLoopProxy* io_message_loop, |
410 base::WaitableEvent* shutdown_event) { | 414 base::WaitableEvent* shutdown_event) { |
411 DCHECK(!channel_.get()); | 415 DCHECK(!channel_.get()); |
412 | 416 |
413 // Map renderer ID to a (single) channel to that process. | 417 // Map renderer ID to a (single) channel to that process. |
414 channel_.reset(new IPC::SyncChannel( | 418 channel_.reset(new IPC::SyncChannel( |
415 channel_id_, | 419 channel_id_, |
416 IPC::Channel::MODE_SERVER, | 420 IPC::Channel::MODE_SERVER, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 uint64 GpuChannel::GetMemoryUsage() { | 841 uint64 GpuChannel::GetMemoryUsage() { |
838 uint64 size = 0; | 842 uint64 size = 0; |
839 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); | 843 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
840 !it.IsAtEnd(); it.Advance()) { | 844 !it.IsAtEnd(); it.Advance()) { |
841 size += it.GetCurrentValue()->GetMemoryUsage(); | 845 size += it.GetCurrentValue()->GetMemoryUsage(); |
842 } | 846 } |
843 return size; | 847 return size; |
844 } | 848 } |
845 | 849 |
846 } // namespace content | 850 } // namespace content |
OLD | NEW |