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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1359163005: Remove surface_id from RenderWidget/RenderWidgetHost and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_creation_preempt
Patch Set: fix more tests Created 5 years, 2 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 // RenderWidget --------------------------------------------------------------- 476 // RenderWidget ---------------------------------------------------------------
477 477
478 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 478 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
479 blink::WebPopupType popup_type, 479 blink::WebPopupType popup_type,
480 const blink::WebScreenInfo& screen_info, 480 const blink::WebScreenInfo& screen_info,
481 bool swapped_out, 481 bool swapped_out,
482 bool hidden, 482 bool hidden,
483 bool never_visible) 483 bool never_visible)
484 : routing_id_(MSG_ROUTING_NONE), 484 : routing_id_(MSG_ROUTING_NONE),
485 surface_id_(0),
486 compositor_deps_(compositor_deps), 485 compositor_deps_(compositor_deps),
487 webwidget_(nullptr), 486 webwidget_(nullptr),
488 opener_id_(MSG_ROUTING_NONE), 487 opener_id_(MSG_ROUTING_NONE),
489 init_complete_(false), 488 init_complete_(false),
490 top_controls_shrink_blink_size_(false), 489 top_controls_shrink_blink_size_(false),
491 top_controls_height_(0.f), 490 top_controls_height_(0.f),
492 next_paint_flags_(0), 491 next_paint_flags_(0),
493 auto_resize_mode_(false), 492 auto_resize_mode_(false),
494 need_update_rect_for_auto_resize_(false), 493 need_update_rect_for_auto_resize_(false),
495 did_show_(false), 494 did_show_(false),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 compositor_deps, popup_type, screen_info, false, false, false)); 551 compositor_deps, popup_type, screen_info, false, false, false));
553 if (widget->Init(opener_id)) { // adds reference on success. 552 if (widget->Init(opener_id)) { // adds reference on success.
554 return widget.get(); 553 return widget.get();
555 } 554 }
556 return NULL; 555 return NULL;
557 } 556 }
558 557
559 // static 558 // static
560 RenderWidget* RenderWidget::CreateForFrame( 559 RenderWidget* RenderWidget::CreateForFrame(
561 int routing_id, 560 int routing_id,
562 int surface_id,
563 bool hidden, 561 bool hidden,
564 const blink::WebScreenInfo& screen_info, 562 const blink::WebScreenInfo& screen_info,
565 CompositorDependencies* compositor_deps, 563 CompositorDependencies* compositor_deps,
566 blink::WebLocalFrame* frame) { 564 blink::WebLocalFrame* frame) {
567 CHECK_NE(routing_id, MSG_ROUTING_NONE); 565 CHECK_NE(routing_id, MSG_ROUTING_NONE);
568 scoped_refptr<RenderWidget> widget( 566 scoped_refptr<RenderWidget> widget(
569 new RenderWidget(compositor_deps, blink::WebPopupTypeNone, screen_info, 567 new RenderWidget(compositor_deps, blink::WebPopupTypeNone, screen_info,
570 false, hidden, false)); 568 false, hidden, false));
571 widget->routing_id_ = routing_id; 569 widget->routing_id_ = routing_id;
572 widget->surface_id_ = surface_id;
573 widget->for_oopif_ = true; 570 widget->for_oopif_ = true;
574 // DoInit increments the reference count on |widget|, keeping it alive after 571 // DoInit increments the reference count on |widget|, keeping it alive after
575 // this function returns. 572 // this function returns.
576 if (widget->DoInit(MSG_ROUTING_NONE, 573 if (widget->DoInit(MSG_ROUTING_NONE,
577 RenderWidget::CreateWebFrameWidget(widget.get(), frame), 574 RenderWidget::CreateWebFrameWidget(widget.get(), frame),
578 nullptr)) { 575 nullptr)) {
579 widget->CompleteInit(); 576 widget->CompleteInit();
580 return widget.get(); 577 return widget.get();
581 } 578 }
582 return nullptr; 579 return nullptr;
(...skipping 17 matching lines...) Expand all
600 NOTREACHED(); 597 NOTREACHED();
601 } 598 }
602 return NULL; 599 return NULL;
603 } 600 }
604 601
605 void RenderWidget::CloseForFrame() { 602 void RenderWidget::CloseForFrame() {
606 OnClose(); 603 OnClose();
607 } 604 }
608 605
609 bool RenderWidget::Init(int32 opener_id) { 606 bool RenderWidget::Init(int32 opener_id) {
610 return DoInit(opener_id, RenderWidget::CreateWebWidget(this), 607 return DoInit(
611 new ViewHostMsg_CreateWidget(opener_id, popup_type_, 608 opener_id, RenderWidget::CreateWebWidget(this),
612 &routing_id_, &surface_id_)); 609 new ViewHostMsg_CreateWidget(opener_id, popup_type_, &routing_id_));
613 } 610 }
614 611
615 bool RenderWidget::DoInit(int32 opener_id, 612 bool RenderWidget::DoInit(int32 opener_id,
616 WebWidget* web_widget, 613 WebWidget* web_widget,
617 IPC::SyncMessage* create_widget_message) { 614 IPC::SyncMessage* create_widget_message) {
618 DCHECK(!webwidget_); 615 DCHECK(!webwidget_);
619 616
620 if (opener_id != MSG_ROUTING_NONE) 617 if (opener_id != MSG_ROUTING_NONE)
621 opener_id_ = opener_id; 618 opener_id_ = opener_id;
622 619
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 } 989 }
993 990
994 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { 991 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
995 // For widgets that are never visible, we don't start the compositor, so we 992 // For widgets that are never visible, we don't start the compositor, so we
996 // never get a request for a cc::OutputSurface. 993 // never get a request for a cc::OutputSurface.
997 DCHECK(!never_visible_); 994 DCHECK(!never_visible_);
998 995
999 #if defined(OS_ANDROID) 996 #if defined(OS_ANDROID)
1000 if (SynchronousCompositorFactory* factory = 997 if (SynchronousCompositorFactory* factory =
1001 SynchronousCompositorFactory::GetInstance()) { 998 SynchronousCompositorFactory::GetInstance()) {
1002 return factory->CreateOutputSurface(routing_id(), surface_id(), 999 return factory->CreateOutputSurface(routing_id(),
1003 frame_swap_message_queue_); 1000 frame_swap_message_queue_);
1004 } 1001 }
1005 #endif 1002 #endif
1006 1003
1007 const base::CommandLine& command_line = 1004 const base::CommandLine& command_line =
1008 *base::CommandLine::ForCurrentProcess(); 1005 *base::CommandLine::ForCurrentProcess();
1009 bool use_software = fallback; 1006 bool use_software = fallback;
1010 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) 1007 if (command_line.HasSwitch(switches::kDisableGpuCompositing))
1011 use_software = true; 1008 use_software = true;
1012 1009
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 // to avoid unnecessarily stalling the compositor thread. 2379 // to avoid unnecessarily stalling the compositor thread.
2383 limits.mapped_memory_reclaim_limit = 2380 limits.mapped_memory_reclaim_limit =
2384 max_transfer_buffer_usage_mb * kBytesPerMegabyte; 2381 max_transfer_buffer_usage_mb * kBytesPerMegabyte;
2385 #endif 2382 #endif
2386 if (compositor) { 2383 if (compositor) {
2387 limits.command_buffer_size = 64 * 1024; 2384 limits.command_buffer_size = 64 * 1024;
2388 limits.start_transfer_buffer_size = 64 * 1024; 2385 limits.start_transfer_buffer_size = 64 * 1024;
2389 limits.min_transfer_buffer_size = 64 * 1024; 2386 limits.min_transfer_buffer_size = 64 * 1024;
2390 } 2387 }
2391 2388
2389 // TODO(piman): we still need to create a View command buffer until
2390 // crbug.com/526196 is fixed. The surface_id doesn't matter, it just needs to
2391 // be !0.
2392 const int32 kDummySurfaceId = 1;
2392 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( 2393 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
2393 new WebGraphicsContext3DCommandBufferImpl(surface_id(), 2394 new WebGraphicsContext3DCommandBufferImpl(
2394 GetURLForGraphicsContext3D(), 2395 kDummySurfaceId, GetURLForGraphicsContext3D(),
2395 gpu_channel_host.get(), 2396 gpu_channel_host.get(), attributes, lose_context_when_out_of_memory,
2396 attributes, 2397 limits, NULL));
2397 lose_context_when_out_of_memory,
2398 limits,
2399 NULL));
2400 return context.Pass(); 2398 return context.Pass();
2401 } 2399 }
2402 2400
2403 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) { 2401 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) {
2404 render_frame_proxies_.AddObserver(proxy); 2402 render_frame_proxies_.AddObserver(proxy);
2405 } 2403 }
2406 2404
2407 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) { 2405 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) {
2408 render_frame_proxies_.RemoveObserver(proxy); 2406 render_frame_proxies_.RemoveObserver(proxy);
2409 } 2407 }
(...skipping 10 matching lines...) Expand all
2420 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2418 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2421 video_hole_frames_.AddObserver(frame); 2419 video_hole_frames_.AddObserver(frame);
2422 } 2420 }
2423 2421
2424 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2422 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2425 video_hole_frames_.RemoveObserver(frame); 2423 video_hole_frames_.RemoveObserver(frame);
2426 } 2424 }
2427 #endif // defined(VIDEO_HOLE) 2425 #endif // defined(VIDEO_HOLE)
2428 2426
2429 } // namespace content 2427 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698