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

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

Issue 1703163002: Remove dependency on GURL from content/common/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Integrate new delegate into content_unittests Created 4 years, 10 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
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61512aaffa1cf9591157723301e12993ba948bc1..5784e0d4d05a19131d03fd68e0de6ba719f17d2d 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -18,6 +18,7 @@
#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_channel_manager_delegate.h"
#include "content/common/gpu/gpu_memory_manager.h"
#include "content/common/gpu/gpu_memory_tracking.h"
#include "content/common/gpu/gpu_messages.h"
@@ -105,22 +106,6 @@ class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker {
DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker);
};
-// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
-// url_hash matches.
-void FastSetActiveURL(const GURL& url, size_t url_hash) {
- // Leave the previously set URL in the empty case -- empty URLs are given by
- // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the
- // onscreen context URL was set previously and will show up even when a crash
- // occurs during offscreen command processing.
- if (url.is_empty())
- return;
- static size_t g_last_url_hash = 0;
- if (url_hash != g_last_url_hash) {
- g_last_url_hash = url_hash;
- GetContentClient()->SetActiveURL(url);
- }
-}
-
// The first time polling a fence, delay some extra time to allow other
// stubs to process some work, or else the timing of the fences could
// allow a pattern of alternating fast and slow frames to occur.
@@ -194,7 +179,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
int32_t route_id,
bool offscreen,
GpuWatchdog* watchdog,
- const GURL& active_url)
+ const std::string& active_url)
: channel_(channel),
sync_point_manager_(sync_point_manager),
task_runner_(task_runner),
@@ -216,7 +201,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
previous_processed_num_(0),
preemption_flag_(preempt_by_flag),
active_url_(active_url) {
- active_url_hash_ = base::Hash(active_url.possibly_invalid_spec());
+ active_url_hash_ = base::Hash(active_url);
FastSetActiveURL(active_url_, active_url_hash_);
gpu::gles2::ContextCreationAttribHelper attrib_parser;
@@ -471,7 +456,7 @@ void GpuCommandBufferStub::Destroy() {
if (initialized_) {
GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
- if (handle_.is_null() && !active_url_.is_empty()) {
+ if (handle_.is_null() && !active_url_.empty()) {
gpu_channel_manager->Send(
new GpuHostMsg_DidDestroyOffscreenContext(active_url_));
}
@@ -674,7 +659,7 @@ void GpuCommandBufferStub::OnInitialize(
reply_message, true, capabilities);
Send(reply_message);
- if (handle_.is_null() && !active_url_.is_empty()) {
+ if (handle_.is_null() && !active_url_.empty()) {
manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
active_url_));
}
@@ -875,6 +860,23 @@ void GpuCommandBufferStub::OnCommandProcessed() {
watchdog_->CheckArmed();
}
+void GpuCommandBufferStub::FastSetActiveURL(const std::string& url,
+ size_t url_hash) {
+ // Leave the previously set URL in the empty case -- empty URLs are given by
+ // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the
+ // onscreen context URL was set previously and will show up even when a crash
+ // occurs during offscreen command processing.
+ if (url.empty())
+ return;
+ static size_t g_last_url_hash = 0;
+ if (url_hash != g_last_url_hash) {
+ g_last_url_hash = url_hash;
+ // Plumb request through to a component that knows about the current active
+ // URLs.
+ channel_->gpu_channel_manager()->delegate()->SetActiveURL(url);
+ }
+}
+
void GpuCommandBufferStub::ReportState() { command_buffer_->UpdateState(); }
void GpuCommandBufferStub::PutChanged() {
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698