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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 1796293003: Image decode color: Push color profile from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows tests Created 4 years, 9 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/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index e4ec5867a1e9be45d9b7166f58cc0767cff4c01b..67cb2864813f88e30513aaebd843f508f2d5e4ab 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -72,6 +72,7 @@
#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/gfx/color_profile.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
#include "ui/gfx/skbitmap_operations.h"
@@ -220,6 +221,13 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
mouse_wheel_coalesce_timer_(new base::ElapsedTimer()),
weak_factory_(this) {
+#if defined(OS_WIN)
+ // Update the display color profile cache so that it is likely to be up to
+ // date when the renderer process requests the color profile.
+ BrowserThread::PostBlockingPoolTask(
+ FROM_HERE, base::Bind(&gfx::UpdateDisplayColorProfileCache));
+#endif
+
CHECK(delegate_);
CHECK_NE(MSG_ROUTING_NONE, routing_id_);
@@ -642,13 +650,13 @@ void RenderWidgetHostImpl::WasResized() {
if (resize_ack_pending_ || !process_->HasConnection() || !view_ ||
!renderer_initialized_ || auto_resize_enabled_ || !delegate_) {
if (resize_ack_pending_ && color_profile_out_of_date_)
- DispatchColorProfile();
+ SendColorProfile();
return;
}
scoped_ptr<ResizeParams> params(new ResizeParams);
if (color_profile_out_of_date_)
- DispatchColorProfile();
+ SendColorProfile();
if (!GetResizeParams(params.get()))
return;
@@ -664,34 +672,15 @@ void RenderWidgetHostImpl::WasResized() {
delegate_->RenderWidgetWasResized(this, width_changed);
}
-void RenderWidgetHostImpl::DispatchColorProfile() {
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
+void RenderWidgetHostImpl::SendColorProfile() {
static bool image_profiles = base::CommandLine::ForCurrentProcess()->
HasSwitch(switches::kEnableImageColorProfiles);
if (!image_profiles)
return;
-#if defined(OS_WIN)
- // Windows will read disk to get the color profile data if needed, so
- // dispatch the SendColorProfile() work off the UI thread.
- BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&RenderWidgetHostImpl::SendColorProfile,
- weak_factory_.GetWeakPtr()));
-#elif !defined(OS_CHROMEOS) && !defined(OS_IOS) && !defined(OS_ANDROID)
- // Only support desktop Mac and Linux at this time.
- SendColorProfile();
-#endif
-#endif
-}
-void RenderWidgetHostImpl::SendColorProfile() {
if (!view_ || !delegate_)
return;
DCHECK(!view_->GetRequestedRendererSize().IsEmpty());
-#if defined(OS_WIN)
- DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
-#endif
std::vector<char> color_profile;
if (!GetScreenColorProfile(&color_profile))
return;

Powered by Google App Engine
This is Rietveld 408576698