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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( | 718 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( |
719 bool defer_compositor_lock) { | 719 bool defer_compositor_lock) { |
720 gfx::Size desired_size = window_->bounds().size(); | 720 gfx::Size desired_size = window_->bounds().size(); |
721 return scoped_ptr<ResizeLock>(new CompositorResizeLock( | 721 return scoped_ptr<ResizeLock>(new CompositorResizeLock( |
722 window_->GetDispatcher(), | 722 window_->GetDispatcher(), |
723 desired_size, | 723 desired_size, |
724 defer_compositor_lock, | 724 defer_compositor_lock, |
725 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); | 725 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); |
726 } | 726 } |
727 | 727 |
| 728 void RenderWidgetHostViewAura::RequestCopyOfOutput( |
| 729 scoped_ptr<cc::CopyOutputRequest> request) { |
| 730 window_->layer()->RequestCopyOfOutput(request.Pass()); |
| 731 } |
| 732 |
728 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 733 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
729 return window_; | 734 return window_; |
730 } | 735 } |
731 | 736 |
732 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 737 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
733 #if defined(OS_WIN) | 738 #if defined(OS_WIN) |
734 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 739 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
735 if (dispatcher) | 740 if (dispatcher) |
736 return reinterpret_cast<gfx::NativeViewId>( | 741 return reinterpret_cast<gfx::NativeViewId>( |
737 dispatcher->host()->GetAcceleratedWidget()); | 742 dispatcher->host()->GetAcceleratedWidget()); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 | 1062 |
1058 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); | 1063 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); |
1059 scoped_ptr<cc::CopyOutputRequest> request = | 1064 scoped_ptr<cc::CopyOutputRequest> request = |
1060 cc::CopyOutputRequest::CreateRequest(base::Bind( | 1065 cc::CopyOutputRequest::CreateRequest(base::Bind( |
1061 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, | 1066 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, |
1062 dst_size_in_pixel, | 1067 dst_size_in_pixel, |
1063 callback)); | 1068 callback)); |
1064 gfx::Rect src_subrect_in_pixel = | 1069 gfx::Rect src_subrect_in_pixel = |
1065 ConvertRectToPixel(current_device_scale_factor_, src_subrect); | 1070 ConvertRectToPixel(current_device_scale_factor_, src_subrect); |
1066 request->set_area(src_subrect_in_pixel); | 1071 request->set_area(src_subrect_in_pixel); |
1067 window_->layer()->RequestCopyOfOutput(request.Pass()); | 1072 RequestCopyOfOutput(request.Pass()); |
1068 } | 1073 } |
1069 | 1074 |
1070 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( | 1075 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( |
1071 const gfx::Rect& src_subrect, | 1076 const gfx::Rect& src_subrect, |
1072 const scoped_refptr<media::VideoFrame>& target, | 1077 const scoped_refptr<media::VideoFrame>& target, |
1073 const base::Callback<void(bool)>& callback) { | 1078 const base::Callback<void(bool)>& callback) { |
1074 if (!CanCopyToVideoFrame()) { | 1079 if (!CanCopyToVideoFrame()) { |
1075 callback.Run(false); | 1080 callback.Run(false); |
1076 return; | 1081 return; |
1077 } | 1082 } |
1078 | 1083 |
1079 // Try get a texture to reuse. | 1084 // Try get a texture to reuse. |
1080 scoped_refptr<OwnedMailbox> subscriber_texture; | 1085 scoped_refptr<OwnedMailbox> subscriber_texture; |
1081 if (frame_subscriber_) { | 1086 if (frame_subscriber_) { |
1082 if (!idle_frame_subscriber_textures_.empty()) { | 1087 if (!idle_frame_subscriber_textures_.empty()) { |
1083 subscriber_texture = idle_frame_subscriber_textures_.back(); | 1088 subscriber_texture = idle_frame_subscriber_textures_.back(); |
1084 idle_frame_subscriber_textures_.pop_back(); | 1089 idle_frame_subscriber_textures_.pop_back(); |
1085 } else if (GLHelper* helper = | 1090 } else if (GLHelper* helper = |
1086 ImageTransportFactory::GetInstance()->GetGLHelper()) { | 1091 ImageTransportFactory::GetInstance()->GetGLHelper()) { |
1087 subscriber_texture = new OwnedMailbox(helper); | 1092 subscriber_texture = new OwnedMailbox(helper); |
1088 } | 1093 } |
| 1094 if (subscriber_texture.get()) |
| 1095 active_frame_subscriber_textures_.insert(subscriber_texture.get()); |
1089 } | 1096 } |
1090 | 1097 |
1091 scoped_ptr<cc::CopyOutputRequest> request = | 1098 scoped_ptr<cc::CopyOutputRequest> request = |
1092 cc::CopyOutputRequest::CreateRequest(base::Bind( | 1099 cc::CopyOutputRequest::CreateRequest(base::Bind( |
1093 &RenderWidgetHostViewAura:: | 1100 &RenderWidgetHostViewAura:: |
1094 CopyFromCompositingSurfaceHasResultForVideo, | 1101 CopyFromCompositingSurfaceHasResultForVideo, |
1095 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. | 1102 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. |
1096 subscriber_texture, | 1103 subscriber_texture, |
1097 target, | 1104 target, |
1098 callback)); | 1105 callback)); |
1099 gfx::Rect src_subrect_in_pixel = | 1106 gfx::Rect src_subrect_in_pixel = |
1100 ConvertRectToPixel(current_device_scale_factor_, src_subrect); | 1107 ConvertRectToPixel(current_device_scale_factor_, src_subrect); |
1101 request->set_area(src_subrect_in_pixel); | 1108 request->set_area(src_subrect_in_pixel); |
1102 if (subscriber_texture) { | 1109 if (subscriber_texture.get()) { |
1103 request->SetTextureMailbox(cc::TextureMailbox( | 1110 request->SetTextureMailbox(cc::TextureMailbox( |
1104 subscriber_texture->mailbox(), subscriber_texture->sync_point())); | 1111 subscriber_texture->mailbox(), subscriber_texture->sync_point())); |
1105 } | 1112 } |
1106 window_->layer()->RequestCopyOfOutput(request.Pass()); | 1113 RequestCopyOfOutput(request.Pass()); |
1107 } | 1114 } |
1108 | 1115 |
1109 bool RenderWidgetHostViewAura::CanCopyToBitmap() const { | 1116 bool RenderWidgetHostViewAura::CanCopyToBitmap() const { |
1110 return GetCompositor() && window_->layer()->has_external_content(); | 1117 return GetCompositor() && window_->layer()->has_external_content(); |
1111 } | 1118 } |
1112 | 1119 |
1113 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { | 1120 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { |
1114 return GetCompositor() && | 1121 return GetCompositor() && |
1115 window_->layer()->has_external_content() && | 1122 window_->layer()->has_external_content() && |
1116 host_->is_accelerated_compositing_active(); | 1123 host_->is_accelerated_compositing_active(); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 ignore_result(scoped_callback_runner.Release()); | 1905 ignore_result(scoped_callback_runner.Release()); |
1899 | 1906 |
1900 SkBitmap bitmap = skia::ImageOperations::Resize( | 1907 SkBitmap bitmap = skia::ImageOperations::Resize( |
1901 *source, | 1908 *source, |
1902 skia::ImageOperations::RESIZE_BEST, | 1909 skia::ImageOperations::RESIZE_BEST, |
1903 dst_size_in_pixel.width(), | 1910 dst_size_in_pixel.width(), |
1904 dst_size_in_pixel.height()); | 1911 dst_size_in_pixel.height()); |
1905 callback.Run(true, bitmap); | 1912 callback.Run(true, bitmap); |
1906 } | 1913 } |
1907 | 1914 |
| 1915 // static |
| 1916 void RenderWidgetHostViewAura::ReturnSubscriberTexture( |
| 1917 base::WeakPtr<RenderWidgetHostViewAura> rwhva, |
| 1918 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 1919 uint32 sync_point) { |
| 1920 if (!subscriber_texture.get()) |
| 1921 return; |
| 1922 if (!rwhva) |
| 1923 return; |
| 1924 DCHECK_NE( |
| 1925 rwhva->active_frame_subscriber_textures_.count(subscriber_texture.get()), |
| 1926 0u); |
| 1927 |
| 1928 subscriber_texture->UpdateSyncPoint(sync_point); |
| 1929 |
| 1930 rwhva->active_frame_subscriber_textures_.erase(subscriber_texture.get()); |
| 1931 if (rwhva->frame_subscriber_ && subscriber_texture->texture_id()) |
| 1932 rwhva->idle_frame_subscriber_textures_.push_back(subscriber_texture); |
| 1933 } |
| 1934 |
1908 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo( | 1935 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo( |
1909 base::WeakPtr<RenderWidgetHostViewAura> rwhva, | 1936 base::WeakPtr<RenderWidgetHostViewAura> rwhva, |
1910 const base::Callback<void(bool)>& callback, | 1937 const base::Callback<void(bool)>& callback, |
1911 scoped_refptr<OwnedMailbox> subscriber_texture, | 1938 scoped_refptr<OwnedMailbox> subscriber_texture, |
1912 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 1939 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
1913 bool result) { | 1940 bool result) { |
1914 callback.Run(result); | 1941 callback.Run(result); |
1915 | 1942 |
1916 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 1943 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
1917 uint32 sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; | 1944 uint32 sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; |
1918 if (release_callback) { | 1945 if (release_callback) { |
| 1946 // A release callback means the texture came from the compositor, so there |
| 1947 // should be no |subscriber_texture|. |
1919 DCHECK(!subscriber_texture); | 1948 DCHECK(!subscriber_texture); |
1920 release_callback->Run(sync_point, false); | 1949 release_callback->Run(sync_point, false); |
1921 } else { | |
1922 // If there's no release callback, then the texture is from | |
1923 // idle_frame_subscriber_textures_ and we can put it back there. | |
1924 DCHECK(subscriber_texture); | |
1925 subscriber_texture->UpdateSyncPoint(sync_point); | |
1926 if (rwhva && rwhva->frame_subscriber_ && subscriber_texture->texture_id()) | |
1927 rwhva->idle_frame_subscriber_textures_.push_back(subscriber_texture); | |
1928 subscriber_texture = NULL; | |
1929 } | 1950 } |
| 1951 ReturnSubscriberTexture(rwhva, subscriber_texture, sync_point); |
1930 } | 1952 } |
1931 | 1953 |
1932 // static | 1954 // static |
1933 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResultForVideo( | 1955 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResultForVideo( |
1934 base::WeakPtr<RenderWidgetHostViewAura> rwhva, | 1956 base::WeakPtr<RenderWidgetHostViewAura> rwhva, |
1935 scoped_refptr<OwnedMailbox> subscriber_texture, | 1957 scoped_refptr<OwnedMailbox> subscriber_texture, |
1936 scoped_refptr<media::VideoFrame> video_frame, | 1958 scoped_refptr<media::VideoFrame> video_frame, |
1937 const base::Callback<void(bool)>& callback, | 1959 const base::Callback<void(bool)>& callback, |
1938 scoped_ptr<cc::CopyOutputResult> result) { | 1960 scoped_ptr<cc::CopyOutputResult> result) { |
1939 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1961 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 1962 base::ScopedClosureRunner scoped_return_subscriber_texture( |
| 1963 base::Bind(&ReturnSubscriberTexture, rwhva, subscriber_texture, 0)); |
1940 | 1964 |
1941 if (!rwhva) | 1965 if (!rwhva) |
1942 return; | 1966 return; |
1943 if (result->IsEmpty()) | 1967 if (result->IsEmpty()) |
1944 return; | 1968 return; |
1945 if (result->size().IsEmpty()) | 1969 if (result->size().IsEmpty()) |
1946 return; | 1970 return; |
1947 | 1971 |
1948 // Compute the dest size we want after the letterboxing resize. Make the | 1972 // Compute the dest size we want after the letterboxing resize. Make the |
1949 // coordinates and sizes even because we letterbox in YUV space | 1973 // coordinates and sizes even because we letterbox in YUV space |
1950 // (see CopyRGBToVideoFrame). They need to be even for the UV samples to | 1974 // (see CopyRGBToVideoFrame). They need to be even for the UV samples to |
1951 // line up correctly. | 1975 // line up correctly. |
1952 // The video frame's coded_size() and the result's size() are both physical | 1976 // The video frame's coded_size() and the result's size() are both physical |
1953 // pixels. | 1977 // pixels. |
1954 gfx::Rect region_in_frame = | 1978 gfx::Rect region_in_frame = |
1955 media::ComputeLetterboxRegion(gfx::Rect(video_frame->coded_size()), | 1979 media::ComputeLetterboxRegion(gfx::Rect(video_frame->coded_size()), |
1956 result->size()); | 1980 result->size()); |
1957 region_in_frame = gfx::Rect(region_in_frame.x() & ~1, | 1981 region_in_frame = gfx::Rect(region_in_frame.x() & ~1, |
1958 region_in_frame.y() & ~1, | 1982 region_in_frame.y() & ~1, |
1959 region_in_frame.width() & ~1, | 1983 region_in_frame.width() & ~1, |
1960 region_in_frame.height() & ~1); | 1984 region_in_frame.height() & ~1); |
1961 if (region_in_frame.IsEmpty()) | 1985 if (region_in_frame.IsEmpty()) |
1962 return; | 1986 return; |
1963 | 1987 |
1964 // We only handle texture readbacks for now. If the compositor is in software | |
1965 // mode, we could produce a software-backed VideoFrame here as well. | |
1966 if (!result->HasTexture()) { | 1988 if (!result->HasTexture()) { |
1967 DCHECK(result->HasBitmap()); | 1989 DCHECK(result->HasBitmap()); |
1968 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap(); | 1990 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap(); |
1969 // Scale the bitmap to the required size, if necessary. | 1991 // Scale the bitmap to the required size, if necessary. |
1970 SkBitmap scaled_bitmap; | 1992 SkBitmap scaled_bitmap; |
1971 if (result->size().width() != region_in_frame.width() || | 1993 if (result->size().width() != region_in_frame.width() || |
1972 result->size().height() != region_in_frame.height()) { | 1994 result->size().height() != region_in_frame.height()) { |
1973 skia::ImageOperations::ResizeMethod method = | 1995 skia::ImageOperations::ResizeMethod method = |
1974 skia::ImageOperations::RESIZE_GOOD; | 1996 skia::ImageOperations::RESIZE_GOOD; |
1975 scaled_bitmap = skia::ImageOperations::Resize(*bitmap.get(), method, | 1997 scaled_bitmap = skia::ImageOperations::Resize(*bitmap.get(), method, |
(...skipping 14 matching lines...) Expand all Loading... |
1990 } | 2012 } |
1991 ignore_result(scoped_callback_runner.Release()); | 2013 ignore_result(scoped_callback_runner.Release()); |
1992 callback.Run(true); | 2014 callback.Run(true); |
1993 return; | 2015 return; |
1994 } | 2016 } |
1995 | 2017 |
1996 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 2018 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
1997 GLHelper* gl_helper = factory->GetGLHelper(); | 2019 GLHelper* gl_helper = factory->GetGLHelper(); |
1998 if (!gl_helper) | 2020 if (!gl_helper) |
1999 return; | 2021 return; |
| 2022 if (subscriber_texture.get() && !subscriber_texture->texture_id()) |
| 2023 return; |
2000 | 2024 |
2001 cc::TextureMailbox texture_mailbox; | 2025 cc::TextureMailbox texture_mailbox; |
2002 scoped_ptr<cc::SingleReleaseCallback> release_callback; | 2026 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
2003 result->TakeTexture(&texture_mailbox, &release_callback); | 2027 result->TakeTexture(&texture_mailbox, &release_callback); |
2004 DCHECK(texture_mailbox.IsTexture()); | 2028 DCHECK(texture_mailbox.IsTexture()); |
2005 if (!texture_mailbox.IsTexture()) | 2029 if (!texture_mailbox.IsTexture()) |
2006 return; | 2030 return; |
2007 | 2031 |
2008 gfx::Rect result_rect(result->size()); | 2032 gfx::Rect result_rect(result->size()); |
2009 | 2033 |
(...skipping 24 matching lines...) Expand all Loading... |
2034 result_rect.size(), | 2058 result_rect.size(), |
2035 result_rect, | 2059 result_rect, |
2036 video_frame->coded_size(), | 2060 video_frame->coded_size(), |
2037 region_in_frame, | 2061 region_in_frame, |
2038 true, | 2062 true, |
2039 true)); | 2063 true)); |
2040 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); | 2064 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); |
2041 } | 2065 } |
2042 | 2066 |
2043 ignore_result(scoped_callback_runner.Release()); | 2067 ignore_result(scoped_callback_runner.Release()); |
| 2068 ignore_result(scoped_return_subscriber_texture.Release()); |
2044 base::Callback<void(bool result)> finished_callback = base::Bind( | 2069 base::Callback<void(bool result)> finished_callback = base::Bind( |
2045 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo, | 2070 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo, |
2046 rwhva->AsWeakPtr(), | 2071 rwhva->AsWeakPtr(), |
2047 callback, | 2072 callback, |
2048 subscriber_texture, | 2073 subscriber_texture, |
2049 base::Passed(&release_callback)); | 2074 base::Passed(&release_callback)); |
2050 yuv_readback_pipeline->ReadbackYUV( | 2075 yuv_readback_pipeline->ReadbackYUV( |
2051 texture_mailbox.name(), | 2076 texture_mailbox.name(), |
2052 texture_mailbox.sync_point(), | 2077 texture_mailbox.sync_point(), |
2053 video_frame.get(), | 2078 video_frame.get(), |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 } | 3242 } |
3218 | 3243 |
3219 //////////////////////////////////////////////////////////////////////////////// | 3244 //////////////////////////////////////////////////////////////////////////////// |
3220 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: | 3245 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: |
3221 | 3246 |
3222 void RenderWidgetHostViewAura::OnLostResources() { | 3247 void RenderWidgetHostViewAura::OnLostResources() { |
3223 current_surface_ = NULL; | 3248 current_surface_ = NULL; |
3224 UpdateExternalTexture(); | 3249 UpdateExternalTexture(); |
3225 | 3250 |
3226 idle_frame_subscriber_textures_.clear(); | 3251 idle_frame_subscriber_textures_.clear(); |
| 3252 yuv_readback_pipeline_.reset(); |
3227 | 3253 |
3228 // Make sure all ImageTransportClients are deleted now that the context those | 3254 // Make sure all ImageTransportClients are deleted now that the context those |
3229 // are using is becoming invalid. This sends pending ACKs and needs to happen | 3255 // are using is becoming invalid. This sends pending ACKs and needs to happen |
3230 // after calling UpdateExternalTexture() which syncs with the impl thread. | 3256 // after calling UpdateExternalTexture() which syncs with the impl thread. |
3231 RunOnCommitCallbacks(); | 3257 RunOnCommitCallbacks(); |
3232 | 3258 |
3233 DCHECK(!shared_surface_handle_.is_null()); | 3259 DCHECK(!shared_surface_handle_.is_null()); |
3234 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 3260 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
3235 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | 3261 factory->DestroySharedSurfaceHandle(shared_surface_handle_); |
3236 shared_surface_handle_ = factory->CreateSharedSurfaceHandle(); | 3262 shared_surface_handle_ = factory->CreateSharedSurfaceHandle(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 3295 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
3270 | 3296 |
3271 // This call is usually no-op since |this| object is already removed from the | 3297 // This call is usually no-op since |this| object is already removed from the |
3272 // Aura root window and we don't have a way to get an input method object | 3298 // Aura root window and we don't have a way to get an input method object |
3273 // associated with the window, but just in case. | 3299 // associated with the window, but just in case. |
3274 DetachFromInputMethod(); | 3300 DetachFromInputMethod(); |
3275 | 3301 |
3276 if (resource_collection_.get()) | 3302 if (resource_collection_.get()) |
3277 resource_collection_->SetClient(NULL); | 3303 resource_collection_->SetClient(NULL); |
3278 | 3304 |
| 3305 // An OwnedMailbox should not refer to the GLHelper anymore once the RWHVA is |
| 3306 // destroyed, as it may then outlive the GLHelper. |
| 3307 for (std::set<OwnedMailbox*>::iterator it = |
| 3308 active_frame_subscriber_textures_.begin(); |
| 3309 it != active_frame_subscriber_textures_.end(); |
| 3310 ++it) { |
| 3311 (*it)->Destroy(); |
| 3312 } |
| 3313 active_frame_subscriber_textures_.clear(); |
| 3314 |
3279 #if defined(OS_WIN) | 3315 #if defined(OS_WIN) |
3280 if (::IsWindow(plugin_parent_window_)) | 3316 if (::IsWindow(plugin_parent_window_)) |
3281 ::DestroyWindow(plugin_parent_window_); | 3317 ::DestroyWindow(plugin_parent_window_); |
3282 #endif | 3318 #endif |
3283 } | 3319 } |
3284 | 3320 |
3285 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 3321 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
3286 const gfx::Point screen_point = | 3322 const gfx::Point screen_point = |
3287 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 3323 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
3288 aura::Window* root_window = window_->GetRootWindow(); | 3324 aura::Window* root_window = window_->GetRootWindow(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3501 RenderWidgetHost* widget) { | 3537 RenderWidgetHost* widget) { |
3502 return new RenderWidgetHostViewAura(widget); | 3538 return new RenderWidgetHostViewAura(widget); |
3503 } | 3539 } |
3504 | 3540 |
3505 // static | 3541 // static |
3506 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3542 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3507 GetScreenInfoForWindow(results, NULL); | 3543 GetScreenInfoForWindow(results, NULL); |
3508 } | 3544 } |
3509 | 3545 |
3510 } // namespace content | 3546 } // namespace content |
OLD | NEW |