Fix super fast hash and blocking pool

This commit is contained in:
Samuel Attard 2017-12-18 18:55:03 +11:00 committed by Aleksei Kuzmin
parent 7c8be94a6e
commit 37a321a601

View file

@ -14,6 +14,7 @@ using base::PlatformThreadRef;
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/media/desktop_media_list_observer.h"
#include "content/public/browser/browser_thread.h"
@ -28,6 +29,8 @@ using base::PlatformThreadRef;
using content::BrowserThread;
using content::DesktopMediaID;
extern "C" uint32_t SuperFastHash(const char* data, int len);
namespace {
// Update the list every second.
@ -37,7 +40,7 @@ const int kDefaultUpdatePeriod = 1000;
// media source has changed.
uint32_t GetFrameHash(webrtc::DesktopFrame* frame) {
int data_size = frame->stride() * frame->size().height();
return base::SuperFastHash(reinterpret_cast<char*>(frame->data()), data_size);
return SuperFastHash(reinterpret_cast<char*>(frame->data()), data_size);
}
gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
@ -235,9 +238,8 @@ NativeDesktopMediaList::NativeDesktopMediaList(
view_dialog_id_(-1),
observer_(NULL),
weak_factory_(this) {
base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
capture_task_runner_ = worker_pool->GetSequencedTaskRunner(
worker_pool->GetSequenceToken());
capture_task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock()});
}
NativeDesktopMediaList::~NativeDesktopMediaList() {