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

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

Issue 11475017: Revert 171569 as it broke some browser_tests on win_aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } // namespace 49 } // namespace
50 50
51 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( 51 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
52 RenderWidgetHostImpl* widget_host, 52 RenderWidgetHostImpl* widget_host,
53 ContentViewCoreImpl* content_view_core) 53 ContentViewCoreImpl* content_view_core)
54 : host_(widget_host), 54 : host_(widget_host),
55 is_layer_attached_(true), 55 is_layer_attached_(true),
56 content_view_core_(NULL), 56 content_view_core_(NULL),
57 ime_adapter_android_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 57 ime_adapter_android_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
58 cached_background_color_(SK_ColorWHITE), 58 cached_background_color_(SK_ColorWHITE),
59 texture_id_in_layer_(0), 59 texture_id_in_layer_(0) {
60 current_buffer_id_(0) {
61 if (CompositorImpl::UsesDirectGL()) { 60 if (CompositorImpl::UsesDirectGL()) {
62 surface_texture_transport_.reset(new SurfaceTextureTransportClient()); 61 surface_texture_transport_.reset(new SurfaceTextureTransportClient());
63 layer_ = surface_texture_transport_->Initialize(); 62 layer_ = surface_texture_transport_->Initialize();
64 } else { 63 } else {
65 texture_layer_ = cc::TextureLayer::create(0); 64 texture_layer_ = cc::TextureLayer::create(0);
66 layer_ = texture_layer_; 65 layer_ = texture_layer_;
67 } 66 }
68 67
69 layer_->setContentsOpaque(true); 68 layer_->setContentsOpaque(true);
70 layer_->setIsDrawable(true); 69 layer_->setIsDrawable(true);
71 70
72 host_->SetView(this); 71 host_->SetView(this);
73 SetContentViewCore(content_view_core); 72 SetContentViewCore(content_view_core);
74 } 73 }
75 74
76 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { 75 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() {
77 SetContentViewCore(NULL); 76 SetContentViewCore(NULL);
78 if (!shared_surface_.is_null()) { 77 if (!shared_surface_.is_null()) {
79 ImageTransportFactoryAndroid::GetInstance()->DestroySharedSurfaceHandle( 78 ImageTransportFactoryAndroid::GetInstance()->DestroySharedSurfaceHandle(
80 shared_surface_); 79 shared_surface_);
81 } 80 }
82 if (texture_id_in_layer_) {
83 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture(
84 texture_id_in_layer_);
85 }
86 } 81 }
87 82
88 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) { 83 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) {
89 NOTIMPLEMENTED(); 84 NOTIMPLEMENTED();
90 } 85 }
91 86
92 void RenderWidgetHostViewAndroid::InitAsPopup( 87 void RenderWidgetHostViewAndroid::InitAsPopup(
93 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { 88 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
94 NOTIMPLEMENTED(); 89 NOTIMPLEMENTED();
95 } 90 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 381
387 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); 382 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap);
388 } 383 }
389 384
390 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() { 385 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() {
391 } 386 }
392 387
393 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( 388 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped(
394 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 389 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
395 int gpu_host_id) { 390 int gpu_host_id) {
396 ImageTransportFactoryAndroid* factory = 391 texture_layer_->setTextureId(params.surface_handle);
397 ImageTransportFactoryAndroid::GetInstance(); 392 DCHECK(texture_layer_ == layer_);
393 layer_->setBounds(params.size);
394 texture_id_in_layer_ = params.surface_handle;
395 texture_size_in_layer_ = params.size;
398 396
399 // TODO(sievers): When running the impl thread in the browser we 397 // TODO(sievers): When running the impl thread in the browser we
400 // need to delay the ACK until after commit and use more than a single 398 // need to delay the ACK until after commit.
401 // texture.
402 DCHECK(!CompositorImpl::IsThreadingEnabled()); 399 DCHECK(!CompositorImpl::IsThreadingEnabled());
403
404 uint64 previous_buffer = current_buffer_id_;
405 if (previous_buffer && texture_id_in_layer_) {
406 DCHECK(id_to_mailbox_.find(previous_buffer) != id_to_mailbox_.end());
407 ImageTransportFactoryAndroid::GetInstance()->ReleaseTexture(
408 texture_id_in_layer_,
409 reinterpret_cast<const signed char*>(
410 id_to_mailbox_[previous_buffer].c_str()));
411 }
412
413 current_buffer_id_ = params.surface_handle;
414 if (!texture_id_in_layer_) {
415 texture_id_in_layer_ = factory->CreateTexture();
416 texture_layer_->setTextureId(texture_id_in_layer_);
417 }
418
419 DCHECK(id_to_mailbox_.find(current_buffer_id_) != id_to_mailbox_.end());
420 ImageTransportFactoryAndroid::GetInstance()->AcquireTexture(
421 texture_id_in_layer_,
422 reinterpret_cast<const signed char*>(
423 id_to_mailbox_[current_buffer_id_].c_str()));
424 texture_layer_->setNeedsDisplay();
425 texture_layer_->setBounds(params.size);
426 texture_size_in_layer_ = params.size;
427
428 uint32 sync_point = 400 uint32 sync_point =
429 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); 401 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint();
430 RenderWidgetHostImpl::AcknowledgeBufferPresent( 402 RenderWidgetHostImpl::AcknowledgeBufferPresent(
431 params.route_id, gpu_host_id, previous_buffer, sync_point); 403 params.route_id, gpu_host_id, true, sync_point);
432 } 404 }
433 405
434 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( 406 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer(
435 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 407 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
436 int gpu_host_id) { 408 int gpu_host_id) {
437 NOTREACHED(); 409 NOTREACHED();
438 } 410 }
439 411
440 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { 412 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() {
441 NOTREACHED(); 413 NOTREACHED();
442 } 414 }
443 415
444 void RenderWidgetHostViewAndroid::AcceleratedSurfaceNew(
445 int32 width_in_pixel, int32 height_in_pixel, uint64 surface_id,
446 const std::string& mailbox_name) {
447 DCHECK(surface_id == 1 || surface_id == 2);
448 id_to_mailbox_[surface_id] = mailbox_name;
449 }
450
451 void RenderWidgetHostViewAndroid::AcceleratedSurfaceRelease() {
452 // This tells us we should free the frontbuffer.
453 if (texture_id_in_layer_) {
454 texture_layer_->setTextureId(0);
455 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture(
456 texture_id_in_layer_);
457 texture_id_in_layer_ = 0;
458 }
459 }
460
461 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( 416 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface(
462 const gfx::Size& desired_size) { 417 const gfx::Size& desired_size) {
463 NOTREACHED(); 418 NOTREACHED();
464 return false; 419 return false;
465 } 420 }
466 421
467 void RenderWidgetHostViewAndroid::StartContentIntent( 422 void RenderWidgetHostViewAndroid::StartContentIntent(
468 const GURL& content_url) { 423 const GURL& content_url) {
469 if (content_view_core_) 424 if (content_view_core_)
470 content_view_core_->StartContentIntent(content_url); 425 content_view_core_->StartContentIntent(content_url);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // RenderWidgetHostView, public: 595 // RenderWidgetHostView, public:
641 596
642 // static 597 // static
643 RenderWidgetHostView* 598 RenderWidgetHostView*
644 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 599 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
645 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 600 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
646 return new RenderWidgetHostViewAndroid(rwhi, NULL); 601 return new RenderWidgetHostViewAndroid(rwhi, NULL);
647 } 602 }
648 603
649 } // namespace content 604 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698