Commit 1de27c2c authored by fdoray's avatar fdoray Committed by Commit bot

Use TaskScheduler instead of WorkerPool in headless_surface_factory.cc.

The following traits are used:

Priority: Inherited (default)
  The priority is inherited from the calling context (i.e. TaskTraits
  are initialized with the priority of the current task).

Shutdown behavior: CONTINUE_ON_SHUTDOWN
  Tasks posted with this mode which have not started executing before
  shutdown is initiated will never run. Tasks with this mode running at
  shutdown will be ignored (the worker will not be joined).

  Note: Tasks that were previously posted to base::WorkerPool should
  use this shutdown behavior because this is how base::WorkerPool
  handles all its tasks.

May Block:
  Tasks posted with MayBlock() may block. This includes but is not
  limited to tasks that wait on synchronous file I/O operations:
  read or write a file from disk, interact with a pipe or a socket,
  rename or delete a file, enumerate files in a directory, etc. This
  trait isn't required for the mere use of locks.

BUG=659191

Review-Url: https://codereview.chromium.org/2609743002
Cr-Commit-Position: refs/heads/master@{#442994}
parent a4bc4842
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/location.h" #include "base/location.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/threading/worker_pool.h" #include "base/task_scheduler/post_task.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
...@@ -53,8 +53,12 @@ class FileSurface : public SurfaceOzoneCanvas { ...@@ -53,8 +53,12 @@ class FileSurface : public SurfaceOzoneCanvas {
// TODO(dnicoara) Use SkImage instead to potentially avoid a copy. // TODO(dnicoara) Use SkImage instead to potentially avoid a copy.
// See crbug.com/361605 for details. // See crbug.com/361605 for details.
if (surface_->getCanvas()->readPixels(&bitmap, 0, 0)) { if (surface_->getCanvas()->readPixels(&bitmap, 0, 0)) {
base::WorkerPool::PostTask( base::PostTaskWithTraits(
FROM_HERE, base::Bind(&WriteDataToFile, location_, bitmap), true); FROM_HERE, base::TaskTraits()
.WithShutdownBehavior(
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
.MayBlock(),
base::Bind(&WriteDataToFile, location_, bitmap));
} }
} }
std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override { std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override {
......
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