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

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

Issue 10695133: Improve GPU process URL crash reporting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 bf38bbda8b141f8d131e52d20ad1e23582018841..b3947b17a8e3f3b833f591944db6a7e229df795e 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -20,6 +20,7 @@
#include "content/common/gpu/image_transport_surface.h"
#include "content/common/gpu/media/gpu_video_decode_accelerator.h"
#include "content/common/gpu/sync_point_manager.h"
+#include "content/public/common/content_client.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "ui/gl/gl_bindings.h"
@@ -29,6 +30,22 @@
#include "content/public/common/sandbox_init.h"
#endif
+namespace {
+
+// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
+// url_hash matches.
Ken Russell (switch to Gerrit) 2012/07/10 23:38:01 Any indication of what kind of speedup this yields
jbates 2012/07/11 00:07:18 From a quick printf run, the majority of FastSetAc
+void FastSetActiveURL(const GURL& url, size_t url_hash) {
+ static GURL g_last_url;
+ static size_t g_last_url_hash;
+ if (url_hash != g_last_url_hash) {
+ g_last_url = url;
+ g_last_url_hash = url_hash;
+ content::GetContentClient()->SetActiveURL(url);
+ }
+}
+
+}
+
GpuCommandBufferStub::SurfaceState::SurfaceState(int32 surface_id,
bool visible,
base::TimeTicks last_used_time)
@@ -50,7 +67,8 @@ GpuCommandBufferStub::GpuCommandBufferStub(
int32 route_id,
int32 surface_id,
GpuWatchdog* watchdog,
- bool software)
+ bool software,
+ const GURL& active_url)
: channel_(channel),
handle_(handle),
initial_size_(size),
@@ -65,7 +83,10 @@ GpuCommandBufferStub::GpuCommandBufferStub(
parent_stub_for_initialization_(),
parent_texture_for_initialization_(0),
watchdog_(watchdog),
- sync_point_wait_count_(0) {
+ sync_point_wait_count_(0),
+ active_url_(active_url) {
+ active_url_hash_ =
+ base::hash<std::string>()(active_url.possibly_invalid_spec());
if (share_group) {
context_group_ = share_group->context_group_;
} else {
@@ -345,8 +366,7 @@ void GpuCommandBufferStub::OnInitialize(
base::Unretained(this)));
command_buffer_->SetPutOffsetChangeCallback(
- base::Bind(&gpu::GpuScheduler::PutChanged,
- base::Unretained(scheduler_.get())));
+ base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this)));
command_buffer_->SetGetBufferChangeCallback(
base::Bind(&gpu::GpuScheduler::SetGetBuffer,
base::Unretained(scheduler_.get())));
@@ -582,6 +602,11 @@ void GpuCommandBufferStub::ReportState() {
}
}
+void GpuCommandBufferStub::PutChanged() {
+ FastSetActiveURL(active_url_, active_url_hash_);
+ scheduler_->PutChanged();
+}
+
void GpuCommandBufferStub::OnCreateVideoDecoder(
media::VideoCodecProfile profile,
IPC::Message* reply_message) {

Powered by Google App Engine
This is Rietveld 408576698