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

Side by Side Diff: chrome/renderer/extensions/cast_streaming_native_handler.cc

Issue 189583004: Cast: Implement log compression and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 "chrome/renderer/extensions/cast_streaming_native_handler.h" 5 #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 get_stats_callbacks_.insert(std::make_pair(transport_id, callback)); 473 get_stats_callbacks_.insert(std::make_pair(transport_id, callback));
474 474
475 transport->GetStats( 475 transport->GetStats(
476 base::Bind(&CastStreamingNativeHandler::CallGetStatsCallback, 476 base::Bind(&CastStreamingNativeHandler::CallGetStatsCallback,
477 weak_factory_.GetWeakPtr(), 477 weak_factory_.GetWeakPtr(),
478 transport_id)); 478 transport_id));
479 } 479 }
480 480
481 void CastStreamingNativeHandler::CallGetRawEventsCallback( 481 void CastStreamingNativeHandler::CallGetRawEventsCallback(
482 int transport_id, 482 int transport_id,
483 scoped_ptr<std::string> raw_events) { 483 scoped_ptr<base::BinaryValue> raw_events) {
484 v8::Isolate* isolate = context()->isolate(); 484 v8::Isolate* isolate = context()->isolate();
485 v8::HandleScope handle_scope(isolate); 485 v8::HandleScope handle_scope(isolate);
486 v8::Context::Scope context_scope(context()->v8_context()); 486 v8::Context::Scope context_scope(context()->v8_context());
487 487
488 RtpStreamCallbackMap::iterator it = 488 RtpStreamCallbackMap::iterator it =
489 get_raw_events_callbacks_.find(transport_id); 489 get_raw_events_callbacks_.find(transport_id);
490 if (it == get_raw_events_callbacks_.end()) 490 if (it == get_raw_events_callbacks_.end())
491 return; 491 return;
492 v8::Handle<v8::Value> callback_args[1]; 492 v8::Handle<v8::Value> callback_args[1];
493 callback_args[0] = v8::String::NewFromUtf8(isolate, 493 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
494 raw_events->data(), 494 callback_args[0] =
495 v8::String::kNormalString, 495 converter->ToV8Value(raw_events.get(), context()->v8_context());
496 raw_events->size());
497 context()->CallFunction(it->second->NewHandle(isolate), 1, callback_args); 496 context()->CallFunction(it->second->NewHandle(isolate), 1, callback_args);
498 get_raw_events_callbacks_.erase(it); 497 get_raw_events_callbacks_.erase(it);
499 } 498 }
500 499
501 void CastStreamingNativeHandler::CallGetStatsCallback( 500 void CastStreamingNativeHandler::CallGetStatsCallback(
502 int transport_id, 501 int transport_id,
503 scoped_ptr<base::DictionaryValue> stats) { 502 scoped_ptr<base::DictionaryValue> stats) {
504 v8::Isolate* isolate = context()->isolate(); 503 v8::Isolate* isolate = context()->isolate();
505 v8::HandleScope handle_scope(isolate); 504 v8::HandleScope handle_scope(isolate);
506 v8::Context::Scope context_scope(context()->v8_context()); 505 v8::Context::Scope context_scope(context()->v8_context());
(...skipping 27 matching lines...) Expand all
534 transport_id); 533 transport_id);
535 if (iter != udp_transport_map_.end()) 534 if (iter != udp_transport_map_.end())
536 return iter->second.get(); 535 return iter->second.get();
537 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); 536 v8::Isolate* isolate = context()->v8_context()->GetIsolate();
538 isolate->ThrowException(v8::Exception::RangeError( 537 isolate->ThrowException(v8::Exception::RangeError(
539 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); 538 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound)));
540 return NULL; 539 return NULL;
541 } 540 }
542 541
543 } // namespace extensions 542 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/cast_streaming_native_handler.h ('k') | chrome/renderer/media/cast_rtp_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698