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

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

Issue 11227033: Move a bunch of code in content\common (as well as a few left in renderer) to the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 2 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) 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(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 19 matching lines...) Expand all
30 #include "ui/gl/gl_switches.h" 30 #include "ui/gl/gl_switches.h"
31 31
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 #include "content/public/common/sandbox_init.h" 33 #include "content/public/common/sandbox_init.h"
34 #endif 34 #endif
35 35
36 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
37 #include "content/common/gpu/stream_texture_manager_android.h" 37 #include "content/common/gpu/stream_texture_manager_android.h"
38 #endif 38 #endif
39 39
40 namespace content {
40 namespace { 41 namespace {
41 42
42 // The GpuCommandBufferMemoryTracker class provides a bridge between the 43 // The GpuCommandBufferMemoryTracker class provides a bridge between the
43 // ContextGroup's memory type managers and the GpuMemoryManager class. 44 // ContextGroup's memory type managers and the GpuMemoryManager class.
44 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { 45 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker {
45 public: 46 public:
46 GpuCommandBufferMemoryTracker(GpuChannel* channel) { 47 GpuCommandBufferMemoryTracker(GpuChannel* channel) {
47 gpu_memory_manager_tracking_group_ = new GpuMemoryTrackingGroup( 48 gpu_memory_manager_tracking_group_ = new GpuMemoryTrackingGroup(
48 channel->renderer_pid(), 49 channel->renderer_pid(),
49 channel->gpu_channel_manager()->gpu_memory_manager()); 50 channel->gpu_channel_manager()->gpu_memory_manager());
(...skipping 18 matching lines...) Expand all
68 void FastSetActiveURL(const GURL& url, size_t url_hash) { 69 void FastSetActiveURL(const GURL& url, size_t url_hash) {
69 // Leave the previously set URL in the empty case -- empty URLs are given by 70 // Leave the previously set URL in the empty case -- empty URLs are given by
70 // WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D. Hopefully the 71 // WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D. Hopefully the
71 // onscreen context URL was set previously and will show up even when a crash 72 // onscreen context URL was set previously and will show up even when a crash
72 // occurs during offscreen command processing. 73 // occurs during offscreen command processing.
73 if (url.is_empty()) 74 if (url.is_empty())
74 return; 75 return;
75 static size_t g_last_url_hash = 0; 76 static size_t g_last_url_hash = 0;
76 if (url_hash != g_last_url_hash) { 77 if (url_hash != g_last_url_hash) {
77 g_last_url_hash = url_hash; 78 g_last_url_hash = url_hash;
78 content::GetContentClient()->SetActiveURL(url); 79 GetContentClient()->SetActiveURL(url);
79 } 80 }
80 } 81 }
81 82
82 // The first time polling a fence, delay some extra time to allow other 83 // The first time polling a fence, delay some extra time to allow other
83 // stubs to process some work, or else the timing of the fences could 84 // stubs to process some work, or else the timing of the fences could
84 // allow a pattern of alternating fast and slow frames to occur. 85 // allow a pattern of alternating fast and slow frames to occur.
85 const int64 kHandleMoreWorkPeriodMs = 2; 86 const int64 kHandleMoreWorkPeriodMs = 2;
86 const int64 kHandleMoreWorkPeriodBusyMs = 1; 87 const int64 kHandleMoreWorkPeriodBusyMs = 1;
87 88
88 } // namespace 89 } // namespace
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 IPC::Message* reply_message) { 639 IPC::Message* reply_message) {
639 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetTransferBuffer"); 640 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetTransferBuffer");
640 if (command_buffer_.get()) { 641 if (command_buffer_.get()) {
641 base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle(); 642 base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle();
642 uint32 size = 0; 643 uint32 size = 0;
643 644
644 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(id); 645 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(id);
645 if (buffer.shared_memory) { 646 if (buffer.shared_memory) {
646 #if defined(OS_WIN) 647 #if defined(OS_WIN)
647 transfer_buffer = NULL; 648 transfer_buffer = NULL;
648 content::BrokerDuplicateHandle(buffer.shared_memory->handle(), 649 BrokerDuplicateHandle(buffer.shared_memory->handle(),
649 channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ | 650 channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ |
650 FILE_MAP_WRITE, 0); 651 FILE_MAP_WRITE, 0);
651 DCHECK(transfer_buffer != NULL); 652 DCHECK(transfer_buffer != NULL);
652 #else 653 #else
653 buffer.shared_memory->ShareToProcess(channel_->renderer_pid(), 654 buffer.shared_memory->ShareToProcess(channel_->renderer_pid(),
654 &transfer_buffer); 655 &transfer_buffer);
655 #endif 656 #endif
656 size = buffer.size; 657 size = buffer.size;
657 } 658 }
658 659
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 void GpuCommandBufferStub::SetMemoryAllocation( 838 void GpuCommandBufferStub::SetMemoryAllocation(
838 const GpuMemoryAllocation& allocation) { 839 const GpuMemoryAllocation& allocation) {
839 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 840 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
840 // This can be called outside of OnMessageReceived, so the context needs to be 841 // This can be called outside of OnMessageReceived, so the context needs to be
841 // made current before calling methods on the surface. 842 // made current before calling methods on the surface.
842 if (!surface_ || !MakeCurrent()) 843 if (!surface_ || !MakeCurrent())
843 return; 844 return;
844 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); 845 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer);
845 } 846 }
846 847
848 } // namespace content
849
847 #endif // defined(ENABLE_GPU) 850 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_memory_allocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698