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

Side by Side Diff: content/browser/media/capture/desktop_capture_device.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/media/capture/desktop_capture_device.h" 5 #include "content/browser/media/capture/desktop_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/feature_list.h" 13 #include "base/feature_list.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
21 #include "base/threading/thread_restrictions.h"
21 #include "base/timer/timer.h" 22 #include "base/timer/timer.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" 24 #include "content/browser/media/capture/desktop_capture_device_uma_types.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/desktop_media_id.h" 26 #include "content/public/browser/desktop_media_id.h"
26 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
27 #include "device/power_save_blocker/power_save_blocker.h" 28 #include "device/power_save_blocker/power_save_blocker.h"
28 #include "media/base/video_util.h" 29 #include "media/base/video_util.h"
29 #include "media/capture/content/capture_resolution_chooser.h" 30 #include "media/capture/content/capture_resolution_chooser.h"
30 #include "third_party/libyuv/include/libyuv/scale_argb.h" 31 #include "third_party/libyuv/include/libyuv/scale_argb.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 const media::VideoCaptureParams& params, 429 const media::VideoCaptureParams& params,
429 std::unique_ptr<Client> client) { 430 std::unique_ptr<Client> client) {
430 thread_.task_runner()->PostTask( 431 thread_.task_runner()->PostTask(
431 FROM_HERE, 432 FROM_HERE,
432 base::Bind(&Core::AllocateAndStart, base::Unretained(core_.get()), params, 433 base::Bind(&Core::AllocateAndStart, base::Unretained(core_.get()), params,
433 base::Passed(&client))); 434 base::Passed(&client)));
434 } 435 }
435 436
436 void DesktopCaptureDevice::StopAndDeAllocate() { 437 void DesktopCaptureDevice::StopAndDeAllocate() {
437 if (core_) { 438 if (core_) {
439 base::ThreadRestrictions::ScopedAllowIO allow_io;
438 thread_.task_runner()->DeleteSoon(FROM_HERE, core_.release()); 440 thread_.task_runner()->DeleteSoon(FROM_HERE, core_.release());
439 thread_.Stop(); 441 thread_.Stop();
440 } 442 }
441 } 443 }
442 444
443 void DesktopCaptureDevice::SetNotificationWindowId( 445 void DesktopCaptureDevice::SetNotificationWindowId(
444 gfx::NativeViewId window_id) { 446 gfx::NativeViewId window_id) {
445 // This may be called after the capturer has been stopped. 447 // This may be called after the capturer has been stopped.
446 if (!core_) 448 if (!core_)
447 return; 449 return;
(...skipping 14 matching lines...) Expand all
462 #else 464 #else
463 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; 465 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT;
464 #endif 466 #endif
465 467
466 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); 468 thread_.StartWithOptions(base::Thread::Options(thread_type, 0));
467 469
468 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); 470 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type));
469 } 471 }
470 472
471 } // namespace content 473 } // namespace content
OLDNEW
« no previous file with comments | « components/subresource_filter/core/common/test_ruleset_creator.cc ('k') | content/public/test/browser_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698