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

Side by Side Diff: content/browser/compositor/delegated_frame_host.cc

Issue 284413002: Fix virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review nits Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/delegated_frame_host.h" 5 #include "content/browser/compositor/delegated_frame_host.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
11 #include "cc/output/copy_output_request.h" 11 #include "cc/output/copy_output_request.h"
12 #include "cc/resources/single_release_callback.h" 12 #include "cc/resources/single_release_callback.h"
13 #include "cc/resources/texture_mailbox.h" 13 #include "cc/resources/texture_mailbox.h"
14 #include "content/browser/compositor/resize_lock.h" 14 #include "content/browser/compositor/resize_lock.h"
15 #include "content/common/gpu/client/gl_helper.h" 15 #include "content/common/gpu/client/gl_helper.h"
16 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 16 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
19 #include "media/base/video_util.h" 19 #include "media/base/video_util.h"
20 #include "skia/ext/image_operations.h" 20 #include "skia/ext/image_operations.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
25 // DelegatedFrameHostClient 25 // DelegatedFrameHostClient
26 26
27 bool DelegatedFrameHostClient::ShouldCreateResizeLock() { 27 bool DelegatedFrameHostClient::ShouldCreateResizeLock() {
28 // On Windows and Linux, holding pointer moves will not help throttling
29 // resizes.
30 // TODO(piman): on Windows we need to block (nested message loop?) the
31 // WM_SIZE event. On Linux we need to throttle at the WM level using
32 // _NET_WM_SYNC_REQUEST.
33 // TODO(ccameron): Mac browser window resizing is incompletely implemented.
34 #if !defined(OS_CHROMEOS)
35 return false;
36 #else
28 return GetDelegatedFrameHost()->ShouldCreateResizeLock(); 37 return GetDelegatedFrameHost()->ShouldCreateResizeLock();
38 #endif
29 } 39 }
30 40
31 void DelegatedFrameHostClient::RequestCopyOfOutput( 41 void DelegatedFrameHostClient::RequestCopyOfOutput(
32 scoped_ptr<cc::CopyOutputRequest> request) { 42 scoped_ptr<cc::CopyOutputRequest> request) {
33 GetDelegatedFrameHost()->RequestCopyOfOutput(request.Pass()); 43 GetDelegatedFrameHost()->RequestCopyOfOutput(request.Pass());
34 } 44 }
35 45
36 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
37 // DelegatedFrameHost 47 // DelegatedFrameHost
38 48
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || 85 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME ||
76 can_lock_compositor_ == NO_PENDING_COMMIT; 86 can_lock_compositor_ == NO_PENDING_COMMIT;
77 87
78 if (can_lock_compositor_ == YES_CAN_LOCK) 88 if (can_lock_compositor_ == YES_CAN_LOCK)
79 can_lock_compositor_ = YES_DID_LOCK; 89 can_lock_compositor_ = YES_DID_LOCK;
80 90
81 resize_lock_ = client_->CreateResizeLock(defer_compositor_lock); 91 resize_lock_ = client_->CreateResizeLock(defer_compositor_lock);
82 } 92 }
83 93
84 bool DelegatedFrameHost::ShouldCreateResizeLock() { 94 bool DelegatedFrameHost::ShouldCreateResizeLock() {
85 // On Windows and Linux, holding pointer moves will not help throttling
86 // resizes.
87 // TODO(piman): on Windows we need to block (nested message loop?) the
88 // WM_SIZE event. On Linux we need to throttle at the WM level using
89 // _NET_WM_SYNC_REQUEST.
90 // TODO(ccameron): Mac browser window resizing is incompletely implemented.
91 #if !defined(OS_CHROMEOS)
92 return false;
93 #else
94 RenderWidgetHostImpl* host = client_->GetHost(); 95 RenderWidgetHostImpl* host = client_->GetHost();
95 96
96 if (resize_lock_) 97 if (resize_lock_)
97 return false; 98 return false;
98 99
99 if (host->should_auto_resize()) 100 if (host->should_auto_resize())
100 return false; 101 return false;
101 102
102 gfx::Size desired_size = client_->DesiredFrameSize(); 103 gfx::Size desired_size = client_->DesiredFrameSize();
103 if (desired_size == current_frame_size_in_dip_) 104 if (desired_size == current_frame_size_in_dip_ || desired_size.IsEmpty())
104 return false; 105 return false;
105 106
106 ui::Compositor* compositor = client_->GetCompositor(); 107 ui::Compositor* compositor = client_->GetCompositor();
107 if (!compositor) 108 if (!compositor)
108 return false; 109 return false;
109 110
110 return true; 111 return true;
111 #endif
112 } 112 }
113 113
114 void DelegatedFrameHost::RequestCopyOfOutput( 114 void DelegatedFrameHost::RequestCopyOfOutput(
115 scoped_ptr<cc::CopyOutputRequest> request) { 115 scoped_ptr<cc::CopyOutputRequest> request) {
116 client_->GetLayer()->RequestCopyOfOutput(request.Pass()); 116 client_->GetLayer()->RequestCopyOfOutput(request.Pass());
117 } 117 }
118 118
119 void DelegatedFrameHost::CopyFromCompositingSurface( 119 void DelegatedFrameHost::CopyFromCompositingSurface(
120 const gfx::Rect& src_subrect, 120 const gfx::Rect& src_subrect,
121 const gfx::Size& dst_size, 121 const gfx::Size& dst_size,
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // that should keep our frame. old_layer will be returned to the 853 // that should keep our frame. old_layer will be returned to the
854 // RecreateLayer caller, and should have a copy. 854 // RecreateLayer caller, and should have a copy.
855 if (frame_provider_.get()) { 855 if (frame_provider_.get()) {
856 new_layer->SetShowDelegatedContent(frame_provider_.get(), 856 new_layer->SetShowDelegatedContent(frame_provider_.get(),
857 current_frame_size_in_dip_); 857 current_frame_size_in_dip_);
858 } 858 }
859 } 859 }
860 860
861 } // namespace content 861 } // namespace content
862 862
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698