summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 23:20:50 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 23:20:50 +0000
commit98c053beb7c6968f8948dc884e014557e8d2d22f (patch)
treeaf17f32ec63de163686dcb51aa432c1a60515c1d
parent14623b1e79e3bd4d5612b913f65c46278dbd449a (diff)
downloadchromium_src-98c053beb7c6968f8948dc884e014557e8d2d22f.zip
chromium_src-98c053beb7c6968f8948dc884e014557e8d2d22f.tar.gz
chromium_src-98c053beb7c6968f8948dc884e014557e8d2d22f.tar.bz2
Merge 144497 - Use capturing with XGetImage() only in screenshot_taker.
GrabWindowSnapshot() happens in the "Report Issue" (c/b/ui/webui/feedback_ui.cc) and XGetImage runs earlier than closing the wrench menu. This could delay the response on "Report Issue" but it's much more important to work correctly for this specific item. R=derat@chromium.org BUG=134818 TEST=manually done on lumpy / selecting "Report Issue" and Ctrl-F5 Review URL: https://chromiumcodereview.appspot.com/10694003 TBR=mukai@chromium.org Review URL: https://chromiumcodereview.appspot.com/10703015 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@144605 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/ash/screenshot_taker.cc17
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot_aura.cc9
2 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/ui/views/ash/screenshot_taker.cc b/chrome/browser/ui/views/ash/screenshot_taker.cc
index e7659ec..a0bda9e 100644
--- a/chrome/browser/ui/views/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/views/ash/screenshot_taker.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#if defined(OS_CHROMEOS)
@@ -117,6 +118,20 @@ void SaveScreenshot(bool is_logged_in,
}
}
+bool GrabWindowSnapshot(aura::Window* window,
+ const gfx::Rect& snapshot_bounds,
+ std::vector<unsigned char>* png_data) {
+#if defined(OS_LINUX)
+ // We use XGetImage() for Linux/ChromeOS for performance reasons.
+ // See crbug.com/119492
+ // TODO(mukai): remove this when the performance issue has been fixed.
+ if (window->GetRootWindow()->GrabSnapshot(snapshot_bounds, png_data))
+ return true;
+#endif // OS_LINUX
+
+ return browser::GrabWindowSnapshot(window, png_data, snapshot_bounds);
+}
+
// How opaque should the layer that we flash onscreen to provide visual
// feedback after the screenshot is taken be?
const float kVisualFeedbackLayerOpacity = 0.25f;
@@ -145,7 +160,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
bool use_24hour_clock = ShouldUse24HourClock();
- if (browser::GrabWindowSnapshot(window, &png_data->data(), rect)) {
+ if (GrabWindowSnapshot(window, rect, &png_data->data())) {
DisplayVisualFeedback(rect);
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
index bb1c594..29a7417 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/dip_util.h"
@@ -19,14 +18,6 @@ namespace browser {
bool GrabWindowSnapshot(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds) {
-#if defined(OS_LINUX)
- // We use XGetImage() for Linux/ChromeOS for performance reasons.
- // See crbug.com/122720
- if (window->GetRootWindow()->GrabSnapshot(
- snapshot_bounds, png_representation))
- return true;
-#endif // OS_LINUX
-
ui::Compositor* compositor = window->layer()->GetCompositor();
gfx::Rect read_pixels_bounds = snapshot_bounds;