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

Side by Side Diff: media/blink/webmediaplayer_impl.h

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: typo Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/memory_pressure_listener.h"
18 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
20 #include "base/optional.h" 21 #include "base/optional.h"
21 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
22 #include "base/time/default_tick_clock.h" 23 #include "base/time/default_tick_clock.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
24 #include "base/timer/elapsed_timer.h" 25 #include "base/timer/elapsed_timer.h"
25 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
26 #include "build/build_config.h" 27 #include "build/build_config.h"
27 #include "media/base/media_observer.h" 28 #include "media/base/media_observer.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 void SetMemoryReportingState(bool is_memory_reporting_enabled); 346 void SetMemoryReportingState(bool is_memory_reporting_enabled);
346 void SetSuspendState(bool is_suspended); 347 void SetSuspendState(bool is_suspended);
347 348
348 // Called at low frequency to tell external observers how much memory we're 349 // Called at low frequency to tell external observers how much memory we're
349 // using for video playback. Called by |memory_usage_reporting_timer_|. 350 // using for video playback. Called by |memory_usage_reporting_timer_|.
350 // Memory usage reporting is done in two steps, because |demuxer_| must be 351 // Memory usage reporting is done in two steps, because |demuxer_| must be
351 // accessed on the media thread. 352 // accessed on the media thread.
352 void ReportMemoryUsage(); 353 void ReportMemoryUsage();
353 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); 354 void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
354 355
356 void OnMemoryPressure(
357 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
358
355 // Called during OnHidden() when we want a suspended player to enter the 359 // Called during OnHidden() when we want a suspended player to enter the
356 // paused state after some idle timeout. 360 // paused state after some idle timeout.
357 void ScheduleIdlePauseTimer(); 361 void ScheduleIdlePauseTimer();
358 362
359 // Returns |true| before HaveFutureData whenever there has been loading 363 // Returns |true| before HaveFutureData whenever there has been loading
360 // progress and we have not been resumed for at least kLoadingToIdleTimeout 364 // progress and we have not been resumed for at least kLoadingToIdleTimeout
361 // since then. 365 // since then.
362 // 366 //
363 // This is used to delay suspension long enough for preroll to complete, which 367 // This is used to delay suspension long enough for preroll to complete, which
364 // is necessay because play() will not be called before HaveFutureData (and 368 // is necessay because play() will not be called before HaveFutureData (and
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // These two are mutually exclusive: 565 // These two are mutually exclusive:
562 // |data_source_| is used for regular resource loads. 566 // |data_source_| is used for regular resource loads.
563 // |chunk_demuxer_| is used for Media Source resource loads. 567 // |chunk_demuxer_| is used for Media Source resource loads.
564 // 568 //
565 // |demuxer_| will contain the appropriate demuxer based on which resource 569 // |demuxer_| will contain the appropriate demuxer based on which resource
566 // load strategy we're using. 570 // load strategy we're using.
567 std::unique_ptr<MultibufferDataSource> data_source_; 571 std::unique_ptr<MultibufferDataSource> data_source_;
568 std::unique_ptr<Demuxer> demuxer_; 572 std::unique_ptr<Demuxer> demuxer_;
569 ChunkDemuxer* chunk_demuxer_; 573 ChunkDemuxer* chunk_demuxer_;
570 574
575 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
576
571 BufferedDataSourceHostImpl buffered_data_source_host_; 577 BufferedDataSourceHostImpl buffered_data_source_host_;
572 linked_ptr<UrlIndex> url_index_; 578 linked_ptr<UrlIndex> url_index_;
573 579
574 // Video rendering members. 580 // Video rendering members.
575 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 581 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
576 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. 582 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|.
577 SkCanvasVideoRenderer skcanvas_video_renderer_; 583 SkCanvasVideoRenderer skcanvas_video_renderer_;
578 584
579 // The compositor layer for displaying the video content when using composited 585 // The compositor layer for displaying the video content when using composited
580 // playback. 586 // playback.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 692
687 // Pipeline media duration overridden by tests. 693 // Pipeline media duration overridden by tests.
688 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; 694 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_;
689 695
690 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 696 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
691 }; 697 };
692 698
693 } // namespace media 699 } // namespace media
694 700
695 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 701 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698