OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <InputScope.h> | 7 #include <InputScope.h> |
8 #include <wtsapi32.h> | 8 #include <wtsapi32.h> |
9 #pragma comment(lib, "wtsapi32.lib") | 9 #pragma comment(lib, "wtsapi32.lib") |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <map> | 12 #include <map> |
13 #include <stack> | 13 #include <stack> |
14 | 14 |
| 15 #include "base/basictypes.h" |
15 #include "base/bind.h" | 16 #include "base/bind.h" |
16 #include "base/bind_helpers.h" | 17 #include "base/callback_helpers.h" |
17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
18 #include "base/debug/trace_event.h" | 19 #include "base/debug/trace_event.h" |
19 #include "base/i18n/rtl.h" | 20 #include "base/i18n/rtl.h" |
20 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
21 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
22 #include "base/win/metro.h" | 23 #include "base/win/metro.h" |
23 #include "base/win/scoped_comptr.h" | 24 #include "base/win/scoped_comptr.h" |
24 #include "base/win/scoped_gdi_object.h" | 25 #include "base/win/scoped_gdi_object.h" |
25 #include "base/win/win_util.h" | 26 #include "base/win/win_util.h" |
26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 const gfx::Size& dst_size, | 879 const gfx::Size& dst_size, |
879 const base::Callback<void(bool, const SkBitmap&)>& callback) { | 880 const base::Callback<void(bool, const SkBitmap&)>& callback) { |
880 base::ScopedClosureRunner scoped_callback_runner( | 881 base::ScopedClosureRunner scoped_callback_runner( |
881 base::Bind(callback, false, SkBitmap())); | 882 base::Bind(callback, false, SkBitmap())); |
882 if (!accelerated_surface_) | 883 if (!accelerated_surface_) |
883 return; | 884 return; |
884 | 885 |
885 if (dst_size.IsEmpty() || src_subrect.IsEmpty()) | 886 if (dst_size.IsEmpty() || src_subrect.IsEmpty()) |
886 return; | 887 return; |
887 | 888 |
888 scoped_callback_runner.Release(); | 889 ignore_result(scoped_callback_runner.Release()); |
889 accelerated_surface_->AsyncCopyTo(src_subrect, dst_size, callback); | 890 accelerated_surface_->AsyncCopyTo(src_subrect, dst_size, callback); |
890 } | 891 } |
891 | 892 |
892 void RenderWidgetHostViewWin::CopyFromCompositingSurfaceToVideoFrame( | 893 void RenderWidgetHostViewWin::CopyFromCompositingSurfaceToVideoFrame( |
893 const gfx::Rect& src_subrect, | 894 const gfx::Rect& src_subrect, |
894 const scoped_refptr<media::VideoFrame>& target, | 895 const scoped_refptr<media::VideoFrame>& target, |
895 const base::Callback<void(bool)>& callback) { | 896 const base::Callback<void(bool)>& callback) { |
896 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 897 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
897 if (!accelerated_surface_) | 898 if (!accelerated_surface_) |
898 return; | 899 return; |
899 | 900 |
900 if (!target || (target->format() != media::VideoFrame::YV12 && | 901 if (!target || (target->format() != media::VideoFrame::YV12 && |
901 target->format() != media::VideoFrame::I420)) | 902 target->format() != media::VideoFrame::I420)) |
902 return; | 903 return; |
903 | 904 |
904 if (src_subrect.IsEmpty()) | 905 if (src_subrect.IsEmpty()) |
905 return; | 906 return; |
906 | 907 |
907 scoped_callback_runner.Release(); | 908 ignore_result(scoped_callback_runner.Release()); |
908 accelerated_surface_->AsyncCopyToVideoFrame(src_subrect, target, callback); | 909 accelerated_surface_->AsyncCopyToVideoFrame(src_subrect, target, callback); |
909 } | 910 } |
910 | 911 |
911 bool RenderWidgetHostViewWin::CanCopyToVideoFrame() const { | 912 bool RenderWidgetHostViewWin::CanCopyToVideoFrame() const { |
912 return accelerated_surface_.get() && render_widget_host_ && | 913 return accelerated_surface_.get() && render_widget_host_ && |
913 render_widget_host_->is_accelerated_compositing_active(); | 914 render_widget_host_->is_accelerated_compositing_active(); |
914 } | 915 } |
915 | 916 |
916 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { | 917 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { |
917 RenderWidgetHostViewBase::SetBackground(background); | 918 RenderWidgetHostViewBase::SetBackground(background); |
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 return new RenderWidgetHostViewWin(widget); | 3199 return new RenderWidgetHostViewWin(widget); |
3199 } | 3200 } |
3200 | 3201 |
3201 // static | 3202 // static |
3202 void RenderWidgetHostViewPort::GetDefaultScreenInfo( | 3203 void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
3203 WebKit::WebScreenInfo* results) { | 3204 WebKit::WebScreenInfo* results) { |
3204 GetScreenInfoForWindow(0, results); | 3205 GetScreenInfoForWindow(0, results); |
3205 } | 3206 } |
3206 | 3207 |
3207 } // namespace content | 3208 } // namespace content |
OLD | NEW |