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

Side by Side Diff: media/blink/webcontentdecryptionmodulesession_impl.cc

Issue 2650033007: media: Fix expiry time convertion from base::Time to JS time (Closed)
Patch Set: media: Fix expiry time convertion from base::Time to JS time 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 #include "webcontentdecryptionmodulesession_impl.h" 5 #include "webcontentdecryptionmodulesession_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 keys[i].setSystemCode(key_info->system_code); 487 keys[i].setSystemCode(key_info->system_code);
488 } 488 }
489 489
490 // Now send the event to blink. 490 // Now send the event to blink.
491 client_->keysStatusesChange(keys, has_additional_usable_key); 491 client_->keysStatusesChange(keys, has_additional_usable_key);
492 } 492 }
493 493
494 void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate( 494 void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate(
495 base::Time new_expiry_time) { 495 base::Time new_expiry_time) {
496 DCHECK(thread_checker_.CalledOnValidThread()); 496 DCHECK(thread_checker_.CalledOnValidThread());
497 client_->expirationChanged(new_expiry_time.ToJsTime()); 497 // The check works around an issue in base::Time that converts null base::Time
498 // to |1601-01-01 00:00:00 UTC| in ToJsTime(). See http://crbug.com/679079
499 client_->expirationChanged(new_expiry_time.is_null()
500 ? std::numeric_limits<double>::quiet_NaN()
501 : new_expiry_time.ToJsTime());
498 } 502 }
499 503
500 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { 504 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() {
501 DCHECK(thread_checker_.CalledOnValidThread()); 505 DCHECK(thread_checker_.CalledOnValidThread());
502 506
503 // Only send one closed event to blink. 507 // Only send one closed event to blink.
504 if (is_closed_) 508 if (is_closed_)
505 return; 509 return;
506 510
507 is_closed_ = true; 511 is_closed_ = true;
(...skipping 12 matching lines...) Expand all
520 524
521 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; 525 DCHECK(session_id_.empty()) << "Session ID may not be changed once set.";
522 session_id_ = session_id; 526 session_id_ = session_id;
523 *status = 527 *status =
524 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) 528 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr())
525 ? SessionInitStatus::NEW_SESSION 529 ? SessionInitStatus::NEW_SESSION
526 : SessionInitStatus::SESSION_ALREADY_EXISTS; 530 : SessionInitStatus::SESSION_ALREADY_EXISTS;
527 } 531 }
528 532
529 } // namespace media 533 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698