OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/protocol/page_handler.h" | 5 #include "content/browser/devtools/protocol/page_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" |
11 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" |
13 #include "base/threading/worker_pool.h" | 16 #include "base/threading/worker_pool.h" |
14 #include "content/browser/devtools/protocol/color_picker.h" | 17 #include "content/browser/devtools/protocol/color_picker.h" |
15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 18 #include "content/browser/renderer_host/render_widget_host_impl.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
17 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
18 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
19 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/javascript_dialog_manager.h" | 23 #include "content/public/browser/javascript_dialog_manager.h" |
21 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
22 #include "content/public/browser/navigation_entry.h" | 25 #include "content/public/browser/navigation_entry.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 422 } |
420 | 423 |
421 void PageHandler::ScreencastFrameCaptured( | 424 void PageHandler::ScreencastFrameCaptured( |
422 const cc::CompositorFrameMetadata& metadata, | 425 const cc::CompositorFrameMetadata& metadata, |
423 const SkBitmap& bitmap, | 426 const SkBitmap& bitmap, |
424 ReadbackResponse response) { | 427 ReadbackResponse response) { |
425 if (response != READBACK_SUCCESS) { | 428 if (response != READBACK_SUCCESS) { |
426 processing_screencast_frame_ = false; | 429 processing_screencast_frame_ = false; |
427 if (capture_retry_count_) { | 430 if (capture_retry_count_) { |
428 --capture_retry_count_; | 431 --capture_retry_count_; |
429 base::MessageLoop::current()->PostDelayedTask( | 432 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
430 FROM_HERE, | 433 FROM_HERE, base::Bind(&PageHandler::InnerSwapCompositorFrame, |
431 base::Bind(&PageHandler::InnerSwapCompositorFrame, | 434 weak_factory_.GetWeakPtr()), |
432 weak_factory_.GetWeakPtr()), | |
433 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs)); | 435 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs)); |
434 } | 436 } |
435 return; | 437 return; |
436 } | 438 } |
437 base::PostTaskAndReplyWithResult( | 439 base::PostTaskAndReplyWithResult( |
438 base::WorkerPool::GetTaskRunner(true).get(), | 440 base::WorkerPool::GetTaskRunner(true).get(), |
439 FROM_HERE, | 441 FROM_HERE, |
440 base::Bind(&EncodeScreencastFrame, | 442 base::Bind(&EncodeScreencastFrame, |
441 bitmap, screencast_format_, screencast_quality_), | 443 bitmap, screencast_format_, screencast_quality_), |
442 base::Bind(&PageHandler::ScreencastFrameEncoded, | 444 base::Bind(&PageHandler::ScreencastFrameEncoded, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 497 |
496 void PageHandler::OnColorPicked(int r, int g, int b, int a) { | 498 void PageHandler::OnColorPicked(int r, int g, int b, int a) { |
497 scoped_refptr<dom::RGBA> color = | 499 scoped_refptr<dom::RGBA> color = |
498 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); | 500 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); |
499 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); | 501 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); |
500 } | 502 } |
501 | 503 |
502 } // namespace page | 504 } // namespace page |
503 } // namespace devtools | 505 } // namespace devtools |
504 } // namespace content | 506 } // namespace content |
OLD | NEW |