Commit 62a66080 authored by blakeo's avatar blakeo Committed by Commit Bot

Add TRACE_EVENT markers to various keyboard functions

Adds the following under the "vk" trace marker group:
- ShowKeyboardInternal
- ShowKeyboardContainerWindow
- ShowKeyboardContainer
- KeyboardLayoutSetChildBounds
- OnTextInputStateChanged
- HideKeyboard
- ReloadKeyboardIfNeeded
- EnsureCaretInWorkArea
- MoveKeyboardToDisplay
- MoveKeyboardToTouchableDisplay
- MoveKeyboardToDisplayInternal
- LoadContents

BUG=725789

Review-Url: https://codereview.chromium.org/2923493002
Cr-Commit-Position: refs/heads/master@{#478539}
parent 84a666fb
......@@ -34,6 +34,7 @@ bool IsSmartVirtualKeyboardEnabled() {
void MoveKeyboardToDisplayInternal(const int64_t display_id) {
// Remove the keyboard from curent root window controller
TRACE_EVENT0("vk", "MoveKeyboardToDisplayInternal");
Shell::Get()->keyboard_ui()->Hide();
RootWindowController::ForWindow(
keyboard::KeyboardController::GetInstance()->GetContainerWindow())
......@@ -111,6 +112,8 @@ void VirtualKeyboardController::MoveKeyboardToDisplay(int64_t display_id) {
DCHECK(keyboard::KeyboardController::GetInstance() != nullptr);
DCHECK(display_id != display::kInvalidDisplayId);
TRACE_EVENT0("vk", "MoveKeyboardToDisplay");
aura::Window* container =
keyboard::KeyboardController::GetInstance()->GetContainerWindow();
DCHECK(container != nullptr);
......@@ -125,6 +128,8 @@ void VirtualKeyboardController::MoveKeyboardToDisplay(int64_t display_id) {
void VirtualKeyboardController::MoveKeyboardToTouchableDisplay() {
DCHECK(keyboard::KeyboardController::GetInstance() != nullptr);
TRACE_EVENT0("vk", "MoveKeyboardToTouchableDisplay");
aura::Window* container =
keyboard::KeyboardController::GetInstance()->GetContainerWindow();
DCHECK(container != nullptr);
......
......@@ -240,6 +240,7 @@ void KeyboardUIContent::ReloadKeyboardIfNeeded() {
// navigate to a keyboard in a different extension. This keeps the UX the
// same as Android. Note we need to explicitly close current page as it
// might try to resize keyboard window in javascript on a resize event.
TRACE_EVENT0("vk", "ReloadKeyboardIfNeeded");
GetKeyboardWindow()->SetBounds(gfx::Rect());
keyboard_contents_->ClosePage();
keyboard_controller()->SetKeyboardMode(FULL_WIDTH);
......@@ -325,6 +326,7 @@ const aura::Window* KeyboardUIContent::GetKeyboardRootWindow() const {
void KeyboardUIContent::LoadContents(const GURL& url) {
if (keyboard_contents_) {
TRACE_EVENT0("vk", "LoadContents");
content::OpenURLParams params(url, content::Referrer(),
WindowOpenDisposition::SINGLETON_TAB,
ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false);
......
......@@ -246,6 +246,8 @@ void KeyboardController::NotifyKeyboardBoundsChanging(
}
void KeyboardController::HideKeyboard(HideReason reason) {
TRACE_EVENT0("vk", "HideKeyboard");
keyboard_visible_ = false;
ToggleTouchEventLogging(true);
......@@ -377,6 +379,8 @@ void KeyboardController::OnTextInputStateChanged(
if (!container_.get())
return;
TRACE_EVENT0("vk", "OnTextInputStateChanged");
ui::TextInputType type =
client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
......@@ -423,6 +427,8 @@ void KeyboardController::ShowKeyboardInternal(int64_t display_id) {
// |Shell::CreateKeyboard| is called.
DCHECK(container_.get());
TRACE_EVENT0("vk", "ShowKeyboardInternal");
if (container_->children().empty()) {
keyboard::MarkKeyboardLoadStarted();
aura::Window* keyboard = ui_->GetKeyboardWindow();
......
......@@ -44,6 +44,8 @@ void KeyboardLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) {
DCHECK(child == keyboard_);
TRACE_EVENT0("vk", "KeyboardLayoutSetChildBounds");
// Request to change the bounds of child window (AKA the virtual keyboard
// window) should change the container window first. Then the child window is
// resized and covers the container window. Note the child's bound is only set
......
......@@ -18,8 +18,14 @@ KeyboardUI::~KeyboardUI() {}
void KeyboardUI::ShowKeyboardContainer(aura::Window* container) {
if (HasKeyboardWindow()) {
GetKeyboardWindow()->Show();
container->Show();
{
TRACE_EVENT0("vk", "ShowKeyboardContainerWindow");
GetKeyboardWindow()->Show();
}
{
TRACE_EVENT0("vk", "ShowKeyboardContainer");
container->Show();
}
}
}
......@@ -34,6 +40,8 @@ void KeyboardUI::EnsureCaretInWorkArea() {
if (!GetInputMethod())
return;
TRACE_EVENT0("vk", "EnsureCaretInWorkArea");
const aura::Window* keyboard_window = GetKeyboardWindow();
const gfx::Rect keyboard_bounds_in_screen =
keyboard_window->IsVisible() ? keyboard_window->GetBoundsInScreen()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment