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

Side by Side Diff: content/browser/devtools/protocol/page_handler.cc

Issue 2608963002: Use TaskScheduler instead of WorkerPool in page_handler.cc. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 11 #include "base/location.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/task_scheduler/post_task.h"
15 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/threading/worker_pool.h"
17 #include "content/browser/devtools/devtools_session.h" 17 #include "content/browser/devtools/devtools_session.h"
18 #include "content/browser/devtools/page_navigation_throttle.h" 18 #include "content/browser/devtools/page_navigation_throttle.h"
19 #include "content/browser/devtools/protocol/color_picker.h" 19 #include "content/browser/devtools/protocol/color_picker.h"
20 #include "content/browser/renderer_host/render_widget_host_impl.h" 20 #include "content/browser/renderer_host/render_widget_host_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_view_base.h" 21 #include "content/browser/renderer_host/render_widget_host_view_base.h"
22 #include "content/browser/web_contents/web_contents_impl.h" 22 #include "content/browser/web_contents/web_contents_impl.h"
23 #include "content/browser/web_contents/web_contents_view.h" 23 #include "content/browser/web_contents/web_contents_view.h"
24 #include "content/common/view_messages.h" 24 #include "content/common/view_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/javascript_dialog_manager.h" 26 #include "content/public/browser/javascript_dialog_manager.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 if (capture_retry_count_) { 509 if (capture_retry_count_) {
510 --capture_retry_count_; 510 --capture_retry_count_;
511 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 511 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
512 FROM_HERE, base::Bind(&PageHandler::InnerSwapCompositorFrame, 512 FROM_HERE, base::Bind(&PageHandler::InnerSwapCompositorFrame,
513 weak_factory_.GetWeakPtr()), 513 weak_factory_.GetWeakPtr()),
514 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs)); 514 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs));
515 } 515 }
516 --frames_in_flight_; 516 --frames_in_flight_;
517 return; 517 return;
518 } 518 }
519 base::PostTaskAndReplyWithResult( 519 base::PostTaskWithTraitsAndReplyWithResult(
520 base::WorkerPool::GetTaskRunner(true).get(), FROM_HERE, 520 FROM_HERE, base::TaskTraits().WithShutdownBehavior(
521 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
521 base::Bind(&EncodeScreencastFrame, bitmap, screencast_format_, 522 base::Bind(&EncodeScreencastFrame, bitmap, screencast_format_,
522 screencast_quality_), 523 screencast_quality_),
523 base::Bind(&PageHandler::ScreencastFrameEncoded, 524 base::Bind(&PageHandler::ScreencastFrameEncoded,
524 weak_factory_.GetWeakPtr(), base::Passed(&metadata), 525 weak_factory_.GetWeakPtr(), base::Passed(&metadata),
525 base::Time::Now())); 526 base::Time::Now()));
526 } 527 }
527 528
528 void PageHandler::ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, 529 void PageHandler::ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata,
529 const base::Time& timestamp, 530 const base::Time& timestamp,
530 const std::string& data) { 531 const std::string& data) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 Response PageHandler::StopLoading() { 583 Response PageHandler::StopLoading() {
583 WebContentsImpl* web_contents = GetWebContents(); 584 WebContentsImpl* web_contents = GetWebContents();
584 if (!web_contents) 585 if (!web_contents)
585 return Response::InternalError(); 586 return Response::InternalError();
586 web_contents->Stop(); 587 web_contents->Stop();
587 return Response::OK(); 588 return Response::OK();
588 } 589 }
589 590
590 } // namespace protocol 591 } // namespace protocol
591 } // namespace content 592 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698