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

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: Rebase Created 4 years, 8 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 4a339c4e142a546ca0508bdcb0d2aa966ddcc769..69be8767c505f1c34530d0d4d70258f879fe4473 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -75,6 +75,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"
@@ -212,6 +213,13 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
new_content_rendering_delay_(
base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
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_);
@@ -623,13 +631,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;
}
std::unique_ptr<ResizeParams> params(new ResizeParams);
if (color_profile_out_of_date_)
- DispatchColorProfile();
+ SendColorProfile();
if (!GetResizeParams(params.get()))
return;
@@ -645,34 +653,14 @@ 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_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