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

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

Issue 2447143003: Use kRenderClientId command line flag when starting a render process (Closed)
Patch Set: Removed SetFrameSinkID IPC; Using base::StringToInt() instead of std::stoi() Created 4 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
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/feature_list.h" 13 #include "base/feature_list.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
22 #include "base/sys_info.h" 23 #include "base/sys_info.h"
23 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
24 #include "base/trace_event/trace_event_synthetic_delay.h" 25 #include "base/trace_event/trace_event_synthetic_delay.h"
25 #include "build/build_config.h" 26 #include "build/build_config.h"
26 #include "cc/output/compositor_frame_sink.h" 27 #include "cc/output/compositor_frame_sink.h"
27 #include "cc/output/copy_output_request.h" 28 #include "cc/output/copy_output_request.h"
28 #include "cc/scheduler/begin_frame_source.h" 29 #include "cc/scheduler/begin_frame_source.h"
29 #include "content/common/content_switches_internal.h" 30 #include "content/common/content_switches_internal.h"
30 #include "content/common/input/synthetic_gesture_packet.h" 31 #include "content/common/input/synthetic_gesture_packet.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, 495 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation,
495 OnEnableDeviceEmulation) 496 OnEnableDeviceEmulation)
496 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, 497 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation,
497 OnDisableDeviceEmulation) 498 OnDisableDeviceEmulation)
498 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) 499 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden)
499 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) 500 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown)
500 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) 501 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
501 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) 502 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
502 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) 503 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
503 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) 504 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
504 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId)
505 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, 505 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests,
506 OnWaitNextFrameForTests) 506 OnWaitNextFrameForTests)
507 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, 507 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate,
508 OnRequestCompositionUpdate) 508 OnRequestCompositionUpdate)
509 #if defined(OS_ANDROID) 509 #if defined(OS_ANDROID)
510 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) 510 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck)
511 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, 511 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate,
512 OnRequestTextInputStateUpdate) 512 OnRequestTextInputStateUpdate)
513 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, 513 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit,
514 OnImeBatchEdit) 514 OnImeBatchEdit)
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 1096
1097 void RenderWidget::AutoResizeCompositor() { 1097 void RenderWidget::AutoResizeCompositor() {
1098 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); 1098 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_);
1099 if (compositor_) 1099 if (compositor_)
1100 compositor_->setViewportSize(physical_backing_size_); 1100 compositor_->setViewportSize(physical_backing_size_);
1101 } 1101 }
1102 1102
1103 void RenderWidget::initializeLayerTreeView() { 1103 void RenderWidget::initializeLayerTreeView() {
1104 DCHECK(!host_closing_); 1104 DCHECK(!host_closing_);
1105 1105
1106 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_, 1106 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_,
Fady Samuel 2016/10/28 20:59:33 Can we just pass the FrameSinkId into here?
1107 compositor_deps_); 1107 compositor_deps_);
1108 compositor_->setViewportSize(physical_backing_size_); 1108 compositor_->setViewportSize(physical_backing_size_);
1109 OnDeviceScaleFactorChanged(); 1109 OnDeviceScaleFactorChanged();
1110 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); 1110 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
1111 // For background pages and certain tests, we don't want to trigger 1111 // For background pages and certain tests, we don't want to trigger
1112 // CompositorFrameSink creation. 1112 // CompositorFrameSink creation.
1113 if (compositor_never_visible_ || !RenderThreadImpl::current()) 1113 if (compositor_never_visible_ || !RenderThreadImpl::current())
1114 compositor_->SetNeverVisible(); 1114 compositor_->SetNeverVisible();
1115 1115
1116 StartCompositor(); 1116 StartCompositor();
1117 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
1118 switches::kRendererClientId));
1119 int32_t client_id;
1120 base::StringToInt(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
1121 switches::kRendererClientId),
1122 &client_id);
1123 compositor_->SetFrameSinkId(cc::FrameSinkId(client_id, routing_id_));
1117 } 1124 }
1118 1125
1119 void RenderWidget::WillCloseLayerTreeView() { 1126 void RenderWidget::WillCloseLayerTreeView() {
1120 if (host_closing_) 1127 if (host_closing_)
1121 return; 1128 return;
1122 1129
1123 // Prevent new compositors or output surfaces from being created. 1130 // Prevent new compositors or output surfaces from being created.
1124 host_closing_ = true; 1131 host_closing_ = true;
1125 1132
1126 // Always send this notification to prevent new layer tree views from 1133 // Always send this notification to prevent new layer tree views from
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 } 1508 }
1502 1509
1503 void RenderWidget::OnUpdateWindowScreenRect( 1510 void RenderWidget::OnUpdateWindowScreenRect(
1504 const gfx::Rect& window_screen_rect) { 1511 const gfx::Rect& window_screen_rect) {
1505 if (screen_metrics_emulator_) 1512 if (screen_metrics_emulator_)
1506 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect); 1513 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect);
1507 else 1514 else
1508 window_screen_rect_ = window_screen_rect; 1515 window_screen_rect_ = window_screen_rect;
1509 } 1516 }
1510 1517
1511 void RenderWidget::OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id) {
1512 if (compositor_)
1513 compositor_->SetFrameSinkId(frame_sink_id);
1514 }
1515
1516 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { 1518 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) {
1517 if (compositor_) 1519 if (compositor_)
1518 compositor_->OnHandleCompositorProto(proto); 1520 compositor_->OnHandleCompositorProto(proto);
1519 } 1521 }
1520 1522
1521 void RenderWidget::showImeIfNeeded() { 1523 void RenderWidget::showImeIfNeeded() {
1522 OnShowImeIfNeeded(); 1524 OnShowImeIfNeeded();
1523 } 1525 }
1524 1526
1525 ui::TextInputType RenderWidget::GetTextInputType() { 1527 ui::TextInputType RenderWidget::GetTextInputType() {
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 bool RenderWidget::isPointerLocked() { 2090 bool RenderWidget::isPointerLocked() {
2089 return mouse_lock_dispatcher_->IsMouseLockedTo( 2091 return mouse_lock_dispatcher_->IsMouseLockedTo(
2090 webwidget_mouse_lock_target_.get()); 2092 webwidget_mouse_lock_target_.get());
2091 } 2093 }
2092 2094
2093 blink::WebWidget* RenderWidget::GetWebWidget() const { 2095 blink::WebWidget* RenderWidget::GetWebWidget() const {
2094 return webwidget_internal_; 2096 return webwidget_internal_;
2095 } 2097 }
2096 2098
2097 } // namespace content 2099 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698