Shaka Player Embedded
debug.cc
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "src/js/debug.h"
16 
17 #include <chrono>
18 #include <thread>
19 
20 namespace shaka {
21 namespace js {
22 
24 // \cond Doxygen_Skip
25 Debug::~Debug() {}
26 // \endcond Doxygen_Skip
27 
29  return object->factory()->name();
30 }
31 
33  std::string ret;
34  const BackingObjectFactoryBase* ptr = object->factory();
35  while (ptr) {
36  if (!ret.empty())
37  ret.append(", ");
38  ret.append(ptr->name());
39  ptr = ptr->base();
40  }
41  return ret;
42 }
43 
44 void Debug::Sleep(uint64_t delay_ms) {
45  std::this_thread::sleep_for(std::chrono::microseconds(delay_ms));
46 }
47 
48 
50  AddStaticFunction("internalTypeName", &Debug::InternalTypeName);
51  AddStaticFunction("indirectBases", &Debug::IndirectBases);
52  AddStaticFunction("sleep", &Debug::Sleep);
53 }
54 
55 
56 } // namespace js
57 } // namespace shaka
static std::string IndirectBases(RefPtr< BackingObject > object)
Definition: debug.cc:32
const std::string & name() const
static void Sleep(uint64_t delay_ms)
Definition: debug.cc:44
const BackingObjectFactoryBase * base() const
static std::string InternalTypeName(RefPtr< BackingObject > object)
Definition: debug.cc:28