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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 8595002: Get rid of gpu_messages.h include in chrome by having the RenderWidgetHostView implementation ask... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix aura/views build Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/backing_store_skia.h" 8 #include "content/browser/renderer_host/backing_store_skia.h"
9 #include "content/browser/renderer_host/render_widget_host.h" 9 #include "content/browser/renderer_host/render_widget_host.h"
10 #include "content/browser/renderer_host/web_input_event_aura.h" 10 #include "content/browser/renderer_host/web_input_event_aura.h"
11 #include "content/public/browser/native_web_keyboard_event.h" 11 #include "content/public/browser/native_web_keyboard_event.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
14 #include "ui/aura/client/aura_constants.h" 14 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/desktop.h" 15 #include "ui/aura/desktop.h"
16 #include "ui/aura/event.h" 16 #include "ui/aura/event.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/aura/window_types.h" 18 #include "ui/aura/window_types.h"
19 #include "ui/base/hit_test.h" 19 #include "ui/base/hit_test.h"
20 #include "ui/base/ui_base_types.h" 20 #include "ui/base/ui_base_types.h"
21 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/compositor/layer.h" 22 #include "ui/gfx/compositor/layer.h"
23 #include "ui/gfx/screen.h" 23 #include "ui/gfx/screen.h"
24 24
25 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 25 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
26 #include "base/bind.h" 26 #include "base/bind.h"
27 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
28 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" 27 #include "content/browser/renderer_host/accelerated_surface_container_linux.h"
29 #include "content/common/gpu/gpu_messages.h"
30 #include "ui/gfx/gl/gl_bindings.h" 28 #include "ui/gfx/gl/gl_bindings.h"
31 #endif 29 #endif
32 30
33 using WebKit::WebTouchEvent; 31 using WebKit::WebTouchEvent;
34 32
35 namespace { 33 namespace {
36 34
37 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
38 void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
39 // It's possible that gpu_host_id is no longer valid at this point (like if
40 // gpu process was restarted after a crash). SendToGpuHost handles this.
41 GpuProcessHostUIShim::SendToGpuHost(gpu_host_id,
42 new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
43 }
44 #endif
45
46 ui::TouchStatus DecideTouchStatus(const WebKit::WebTouchEvent& event, 35 ui::TouchStatus DecideTouchStatus(const WebKit::WebTouchEvent& event,
47 WebKit::WebTouchPoint* point) { 36 WebKit::WebTouchPoint* point) {
48 if (event.type == WebKit::WebInputEvent::TouchStart && 37 if (event.type == WebKit::WebInputEvent::TouchStart &&
49 event.touchesLength == 1) 38 event.touchesLength == 1)
50 return ui::TOUCH_STATUS_START; 39 return ui::TOUCH_STATUS_START;
51 40
52 if (event.type == WebKit::WebInputEvent::TouchMove && point == NULL) 41 if (event.type == WebKit::WebInputEvent::TouchMove && point == NULL)
53 return ui::TOUCH_STATUS_CONTINUE; 42 return ui::TOUCH_STATUS_CONTINUE;
54 43
55 if (event.type == WebKit::WebInputEvent::TouchEnd && 44 if (event.type == WebKit::WebInputEvent::TouchEnd &&
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 294
306 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( 295 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
307 uint64 surface_id, 296 uint64 surface_id,
308 int32 route_id, 297 int32 route_id,
309 int gpu_host_id) { 298 int gpu_host_id) {
310 window_->layer()->SetExternalTexture( 299 window_->layer()->SetExternalTexture(
311 accelerated_surface_containers_[surface_id]->GetTexture()); 300 accelerated_surface_containers_[surface_id]->GetTexture());
312 glFlush(); 301 glFlush();
313 302
314 if (!window_->layer()->GetCompositor()) { 303 if (!window_->layer()->GetCompositor()) {
315 // We have no compositor, so we have no way to display the surface 304 // We have no compositor, so we have no way to display the surface.
316 AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK 305 // Must still send the ACK.
306 host_->AcknowledgeSwapBuffers(route_id, gpu_host_id);
317 } else { 307 } else {
318 window_->layer()->ScheduleDraw(); 308 window_->layer()->ScheduleDraw();
319 309
320 // Add sending an ACK to the list of things to do OnCompositingEnded 310 // Add sending an ACK to the list of things to do OnCompositingEnded
321 on_compositing_ended_callbacks_.push_back( 311 on_compositing_ended_callbacks_.push_back(
322 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); 312 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers,
313 base::Unretained(host_), route_id, gpu_host_id));
323 ui::Compositor* compositor = window_->layer()->GetCompositor(); 314 ui::Compositor* compositor = window_->layer()->GetCompositor();
324 if (!compositor->HasObserver(this)) 315 if (!compositor->HasObserver(this))
325 compositor->AddObserver(this); 316 compositor->AddObserver(this);
326 } 317 }
327 } 318 }
328 319
329 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { 320 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) {
330 accelerated_surface_containers_.erase(surface_id); 321 accelerated_surface_containers_.erase(surface_id);
331 } 322 }
332 #endif 323 #endif
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // static 535 // static
545 void RenderWidgetHostView::GetDefaultScreenInfo( 536 void RenderWidgetHostView::GetDefaultScreenInfo(
546 WebKit::WebScreenInfo* results) { 537 WebKit::WebScreenInfo* results) {
547 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); 538 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize();
548 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); 539 results->rect = WebKit::WebRect(0, 0, size.width(), size.height());
549 results->availableRect = results->rect; 540 results->availableRect = results->rect;
550 // TODO(derat): Don't hardcode this? 541 // TODO(derat): Don't hardcode this?
551 results->depth = 24; 542 results->depth = 24;
552 results->depthPerComponent = 8; 543 results->depthPerComponent = 8;
553 } 544 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698