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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include <cmath> 28 #include <cmath>
29 #include <limits> 29 #include <limits>
30 #include "bindings/core/v8/DOMWrapperWorld.h" 30 #include "bindings/core/v8/DOMWrapperWorld.h"
31 #include "bindings/core/v8/ScriptPromise.h" 31 #include "bindings/core/v8/ScriptPromise.h"
32 #include "bindings/core/v8/ScriptPromiseResolver.h" 32 #include "bindings/core/v8/ScriptPromiseResolver.h"
33 #include "bindings/core/v8/ScriptState.h" 33 #include "bindings/core/v8/ScriptState.h"
34 #include "bindings/core/v8/V8ThrowException.h" 34 #include "bindings/core/v8/V8ThrowException.h"
35 #include "core/dom/DOMArrayBuffer.h" 35 #include "core/dom/DOMArrayBuffer.h"
36 #include "core/dom/DOMException.h" 36 #include "core/dom/DOMException.h"
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "core/dom/ExecutionContext.h"
38 #include "core/dom/TaskRunnerHelper.h" 39 #include "core/dom/TaskRunnerHelper.h"
39 #include "core/events/Event.h" 40 #include "core/events/Event.h"
40 #include "core/events/GenericEventQueue.h" 41 #include "core/events/GenericEventQueue.h"
41 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" 42 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h"
42 #include "modules/encryptedmedia/EncryptedMediaUtils.h" 43 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
43 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" 44 #include "modules/encryptedmedia/MediaKeyMessageEvent.h"
44 #include "modules/encryptedmedia/MediaKeys.h" 45 #include "modules/encryptedmedia/MediaKeys.h"
45 #include "platform/ContentDecryptionModuleResult.h" 46 #include "platform/ContentDecryptionModuleResult.h"
46 #include "platform/InstanceCounters.h" 47 #include "platform/InstanceCounters.h"
47 #include "platform/Timer.h" 48 #include "platform/Timer.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 MediaKeySession* MediaKeySession::Create( 359 MediaKeySession* MediaKeySession::Create(
359 ScriptState* script_state, 360 ScriptState* script_state,
360 MediaKeys* media_keys, 361 MediaKeys* media_keys,
361 WebEncryptedMediaSessionType session_type) { 362 WebEncryptedMediaSessionType session_type) {
362 return new MediaKeySession(script_state, media_keys, session_type); 363 return new MediaKeySession(script_state, media_keys, session_type);
363 } 364 }
364 365
365 MediaKeySession::MediaKeySession(ScriptState* script_state, 366 MediaKeySession::MediaKeySession(ScriptState* script_state,
366 MediaKeys* media_keys, 367 MediaKeys* media_keys,
367 WebEncryptedMediaSessionType session_type) 368 WebEncryptedMediaSessionType session_type)
368 : ContextLifecycleObserver(script_state->GetExecutionContext()), 369 : ContextLifecycleObserver(ExecutionContext::From(script_state)),
369 async_event_queue_(GenericEventQueue::Create(this)), 370 async_event_queue_(GenericEventQueue::Create(this)),
370 media_keys_(media_keys), 371 media_keys_(media_keys),
371 session_type_(session_type), 372 session_type_(session_type),
372 expiration_(std::numeric_limits<double>::quiet_NaN()), 373 expiration_(std::numeric_limits<double>::quiet_NaN()),
373 key_statuses_map_(new MediaKeyStatusMap()), 374 key_statuses_map_(new MediaKeyStatusMap()),
374 is_uninitialized_(true), 375 is_uninitialized_(true),
375 is_callable_(false), 376 is_callable_(false),
376 is_closed_(false), 377 is_closed_(false),
377 closed_promise_(new ClosedPromise(script_state->GetExecutionContext(), 378 closed_promise_(new ClosedPromise(ExecutionContext::From(script_state),
378 this, 379 this,
379 ClosedPromise::kClosed)), 380 ClosedPromise::kClosed)),
380 action_timer_( 381 action_timer_(
381 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state), 382 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state),
382 this, 383 this,
383 &MediaKeySession::ActionTimerFired) { 384 &MediaKeySession::ActionTimerFired) {
384 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; 385 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
385 InstanceCounters::IncrementCounter(InstanceCounters::kMediaKeySessionCounter); 386 InstanceCounters::IncrementCounter(InstanceCounters::kMediaKeySessionCounter);
386 387
387 // Create the matching Chromium object. It will not be usable until 388 // Create the matching Chromium object. It will not be usable until
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 visitor->Trace(async_event_queue_); 1052 visitor->Trace(async_event_queue_);
1052 visitor->Trace(pending_actions_); 1053 visitor->Trace(pending_actions_);
1053 visitor->Trace(media_keys_); 1054 visitor->Trace(media_keys_);
1054 visitor->Trace(key_statuses_map_); 1055 visitor->Trace(key_statuses_map_);
1055 visitor->Trace(closed_promise_); 1056 visitor->Trace(closed_promise_);
1056 EventTargetWithInlineData::Trace(visitor); 1057 EventTargetWithInlineData::Trace(visitor);
1057 ContextLifecycleObserver::Trace(visitor); 1058 ContextLifecycleObserver::Trace(visitor);
1058 } 1059 }
1059 1060
1060 } // namespace blink 1061 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698