Skip to content

Commit

Permalink
[Chromecast] Add Initialize/Finalize to RebootShlib api.
Browse files Browse the repository at this point in the history
Need to be able to pass commandline args to reboot shlib, so add
Initialize method (and corresponding finalize).

BUG= internal b/27494734
TEST= built for device and tested reboot api

Review-Url: https://codereview.chromium.org/2187703004
Cr-Commit-Position: refs/heads/master@{#408415}
  • Loading branch information
mbjorge authored and Commit bot committed Jul 28, 2016
1 parent ed75fec commit 7ade639
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
9 changes: 9 additions & 0 deletions chromecast/public/reboot_shlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#ifndef CHROMECAST_PUBLIC_REBOOT_SHLIB_H_
#define CHROMECAST_PUBLIC_REBOOT_SHLIB_H_

#include <string>
#include <vector>

#include "chromecast_export.h"

namespace chromecast {
Expand Down Expand Up @@ -56,6 +59,12 @@ class CHROMECAST_EXPORT RebootShlib {
FDR = 8,
};

// Initializes any platform-specific reboot systems.
static void Initialize(const std::vector<std::string>& argv);

// Tears down and uninitializes any platform-specific reboot systems.
static void Finalize();

// Returns whether this shlib is supported. If this returns true, it
// indicates that IsRebootSourceSupported will be true for at least one
// RebootSource.
Expand Down
4 changes: 4 additions & 0 deletions chromecast/system/reboot/reboot_dummy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

namespace chromecast {

void RebootShlib::Initialize(const std::vector<std::string>& /* argv */) {}

void RebootShlib::Finalize() {}

bool RebootShlib::IsSupported() {
return false;
}
Expand Down
12 changes: 9 additions & 3 deletions chromecast/system/reboot/reboot_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_INTERNAL_SYSTEM_REBOOT_REBOOT_UTIL_H_
#define CHROMECAST_INTERNAL_SYSTEM_REBOOT_REBOOT_UTIL_H_
#ifndef CHROMECAST_SYSTEM_REBOOT_REBOOT_UTIL_H_
#define CHROMECAST_SYSTEM_REBOOT_REBOOT_UTIL_H_

#include <string>
#include <vector>

#include "chromecast/public/reboot_shlib.h"

Expand All @@ -17,6 +20,9 @@ namespace chromecast {
class RebootUtil {
public:

static void Initialize(const std::vector<std::string>& argv);
static void Finalize();

// Indicates if any RebootSources are supported for rebooting.
static bool IsRebootSupported();

Expand Down Expand Up @@ -49,4 +55,4 @@ class RebootUtil {

} // namespace chromecast

#endif // CHROMECAST_INTERNAL_SYSTEM_REBOOT_REBOOT_UTIL_H_
#endif // CHROMECAST_SYSTEM_REBOOT_REBOOT_UTIL_H_
10 changes: 10 additions & 0 deletions chromecast/system/reboot/reboot_util_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@

namespace chromecast {

// static
void RebootUtil::Initialize(const std::vector<std::string>& argv) {
RebootShlib::Initialize(argv);
}

// static
void RebootUtil::Finalize() {
RebootShlib::Finalize();
}

// static
bool RebootUtil::IsRebootSupported() {
return RebootShlib::IsSupported();
Expand Down

0 comments on commit 7ade639

Please sign in to comment.