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

Side by Side Diff: content/browser/frame_host/navigation_entry_screenshot_manager.cc

Issue 188633002: Query the preferred readback config in CopyFromBackingStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Preferred format support for all functions. Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" 5 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/worker_pool.h" 8 #include "base/threading/worker_pool.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 owner_->GetEntryAtIndex(i))); 127 owner_->GetEntryAtIndex(i)));
128 } 128 }
129 DCHECK_EQ(GetScreenshotCount(), 0); 129 DCHECK_EQ(GetScreenshotCount(), 0);
130 } 130 }
131 131
132 void NavigationEntryScreenshotManager::TakeScreenshotImpl( 132 void NavigationEntryScreenshotManager::TakeScreenshotImpl(
133 RenderViewHost* host, 133 RenderViewHost* host,
134 NavigationEntryImpl* entry) { 134 NavigationEntryImpl* entry) {
135 DCHECK(host && host->GetView()); 135 DCHECK(host && host->GetView());
136 DCHECK(entry); 136 DCHECK(entry);
137 host->CopyFromBackingStore(gfx::Rect(), 137 SkBitmap::Config preffered_format = host->PreferredReadbackFormat();
piman 2014/03/10 18:27:20 typo: preferred_format.
sivag 2014/03/11 14:41:50 Done.
138 host->CopyFromBackingStore(
139 gfx::Rect(),
138 host->GetView()->GetViewBounds().size(), 140 host->GetView()->GetViewBounds().size(),
139 base::Bind(&NavigationEntryScreenshotManager::OnScreenshotTaken, 141 base::Bind(&NavigationEntryScreenshotManager::OnScreenshotTaken,
140 screenshot_factory_.GetWeakPtr(), 142 screenshot_factory_.GetWeakPtr(),
141 entry->GetUniqueID())); 143 entry->GetUniqueID()),
144 preffered_format);
142 } 145 }
143 146
144 void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS( 147 void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS(
145 int interval_ms) { 148 int interval_ms) {
146 DCHECK_GE(interval_ms, 0); 149 DCHECK_GE(interval_ms, 0);
147 min_screenshot_interval_ms_ = interval_ms; 150 min_screenshot_interval_ms_ = interval_ms;
148 } 151 }
149 152
150 void NavigationEntryScreenshotManager::OnScreenshotTaken(int unique_id, 153 void NavigationEntryScreenshotManager::OnScreenshotTaken(int unique_id,
151 bool success, 154 bool success,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 owner_->GetEntryAtIndex(forward)); 287 owner_->GetEntryAtIndex(forward));
285 if (ClearScreenshot(entry)) 288 if (ClearScreenshot(entry))
286 --screenshot_count; 289 --screenshot_count;
287 ++forward; 290 ++forward;
288 } 291 }
289 CHECK_GE(screenshot_count, 0); 292 CHECK_GE(screenshot_count, 0);
290 CHECK_LE(screenshot_count, kMaxScreenshots); 293 CHECK_LE(screenshot_count, kMaxScreenshots);
291 } 294 }
292 295
293 } // namespace content 296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698