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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 9289052: Adding GpuMemoryManager to track GpuCommandBufferStub visibility and last_used_time and dictate mem… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor updates, working on tests Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index ff485a74dcf36996da8fe032202a001bbca35d47..682ad64557ee353f700c21c4739c39e2e52f6693 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -9,11 +9,13 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/shared_memory.h"
+#include "base/time.h"
#include "build/build_config.h"
#include "content/common/gpu/gpu_channel.h"
#include "content/common/gpu/gpu_channel_manager.h"
#include "content/common/gpu/gpu_command_buffer_stub.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/gpu/gpu_memory_manager.h"
#include "content/common/gpu/gpu_watchdog.h"
#include "content/common/gpu/image_transport_surface.h"
#include "gpu/command_buffer/common/constants.h"
@@ -43,6 +45,8 @@ GpuCommandBufferStub::GpuCommandBufferStub(
route_id_(route_id),
software_(software),
last_flush_count_(0),
+ surface_state_(),
nduca 2012/01/31 06:53:47 once you get this sorted, I think you should initi
mmocny 2012/01/31 18:54:57 Done.
+ affected_surface_ids_(),
surface_id_(surface_id),
parent_stub_for_initialization_(),
parent_texture_for_initialization_(0),
@@ -54,6 +58,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
bool bind_generates_resource = true;
context_group_ = new gpu::gles2::ContextGroup(bind_generates_resource);
}
+ surface_state_.surface_id = surface_id_;
}
GpuCommandBufferStub::~GpuCommandBufferStub() {
@@ -153,6 +158,8 @@ void GpuCommandBufferStub::Destroy() {
context_ = NULL;
surface_ = NULL;
+
+ channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
}
void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) {
@@ -274,6 +281,9 @@ void GpuCommandBufferStub::OnInitialize(
GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true);
Send(reply_message);
+
+ surface_state_.visible = true;
jonathan.backer 2012/01/31 18:13:58 If I open up a tab in the background, what happens
mmocny 2012/01/31 18:54:57 Tabs open in the background get a "WasHidden" mess
+ channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
}
void GpuCommandBufferStub::OnSetGetBuffer(
@@ -496,6 +506,9 @@ void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
surface_->SetVisible(visible);
+ surface_state_.visible = visible;
+ surface_state_.last_used_time = base::TimeTicks::Now();
+ channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
}
void GpuCommandBufferStub::SendConsoleMessage(
@@ -510,4 +523,17 @@ void GpuCommandBufferStub::SendConsoleMessage(
Send(msg);
}
+const GpuSurfaceState& GpuCommandBufferStub::surface_state() {
+ return surface_state_;
+}
+
+const std::vector<int32>& GpuCommandBufferStub::affected_surface_ids() {
+ return affected_surface_ids_;
nduca 2012/01/31 06:53:47 does affected_surface_ids for a view-command-buffe
mmocny 2012/01/31 18:54:57 Done.
+}
+
+void GpuCommandBufferStub::SendMemoryAllocation(
+ const GpuMemoryAllocation& allocation) {
+ // TODO(mmocny): Send callback once gl extensions are added
nduca 2012/01/31 06:53:47 sentences end with .
mmocny 2012/01/31 18:54:57 Done.
+}
+
#endif // defined(ENABLE_GPU)

Powered by Google App Engine
This is Rietveld 408576698