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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 11280251: chrome: Use skia::RefPtr for skia ref-counted objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linuxbuild Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/badge_util.cc ('k') | chrome/renderer/safe_browsing/phishing_thumbnailer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 811 }
812 } 812 }
813 813
814 bool ChromeRenderViewObserver::CaptureSnapshot(WebView* view, 814 bool ChromeRenderViewObserver::CaptureSnapshot(WebView* view,
815 SkBitmap* snapshot) { 815 SkBitmap* snapshot) {
816 base::TimeTicks beginning_time = base::TimeTicks::Now(); 816 base::TimeTicks beginning_time = base::TimeTicks::Now();
817 817
818 view->layout(); 818 view->layout();
819 const WebSize& size = view->size(); 819 const WebSize& size = view->size();
820 820
821 SkCanvas* canvas = skia::CreatePlatformCanvas(size.width, size.height, true, 821 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(
822 NULL, skia::RETURN_NULL_ON_FAILURE); 822 skia::CreatePlatformCanvas(
823 size.width, size.height, true, NULL, skia::RETURN_NULL_ON_FAILURE));
823 if (!canvas) 824 if (!canvas)
824 return false; 825 return false;
825 826
826 SkAutoUnref au(canvas); 827 view->paint(webkit_glue::ToWebCanvas(canvas.get()),
827 view->paint(webkit_glue::ToWebCanvas(canvas),
828 WebRect(0, 0, size.width, size.height)); 828 WebRect(0, 0, size.width, size.height));
829 // TODO: Add a way to snapshot the whole page, not just the currently 829 // TODO: Add a way to snapshot the whole page, not just the currently
830 // visible part. 830 // visible part.
831 831
832 SkDevice* device = skia::GetTopDevice(*canvas); 832 SkDevice* device = skia::GetTopDevice(*canvas);
833 833
834 const SkBitmap& bitmap = device->accessBitmap(false); 834 const SkBitmap& bitmap = device->accessBitmap(false);
835 if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config)) 835 if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config))
836 return false; 836 return false;
837 837
838 HISTOGRAM_TIMES("Renderer4.Snapshot", 838 HISTOGRAM_TIMES("Renderer4.Snapshot",
839 base::TimeTicks::Now() - beginning_time); 839 base::TimeTicks::Now() - beginning_time);
840 return true; 840 return true;
841 } 841 }
842 842
843 ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() { 843 ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() {
844 if (!external_host_bindings_.get()) { 844 if (!external_host_bindings_.get()) {
845 external_host_bindings_.reset(new ExternalHostBindings( 845 external_host_bindings_.reset(new ExternalHostBindings(
846 render_view(), routing_id())); 846 render_view(), routing_id()));
847 } 847 }
848 return external_host_bindings_.get(); 848 return external_host_bindings_.get();
849 } 849 }
850 850
851 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { 851 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) {
852 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); 852 return (strict_security_hosts_.find(host) != strict_security_hosts_.end());
853 } 853 }
OLDNEW
« no previous file with comments | « chrome/common/badge_util.cc ('k') | chrome/renderer/safe_browsing/phishing_thumbnailer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698