[chromium-style] out-of-line default constructors and destructors

This commit is contained in:
Jeremy Apthorp 2018-04-17 16:37:22 -07:00
parent 6c26bb1cf8
commit f1587da480
48 changed files with 136 additions and 12 deletions

View file

@ -349,6 +349,16 @@ struct Converter<content::CertificateRequestResultType> {
namespace atom {
ProcessMetric::ProcessMetric(int type,
base::ProcessId pid,
std::unique_ptr<base::ProcessMetrics> metrics) {
this->type = type;
this->pid = pid;
this->metrics = std::move(metrics);
}
ProcessMetric::~ProcessMetric() = default;
namespace api {
namespace {

View file

@ -52,11 +52,8 @@ struct ProcessMetric {
ProcessMetric(int type,
base::ProcessId pid,
std::unique_ptr<base::ProcessMetrics> metrics) {
this->type = type;
this->pid = pid;
this->metrics = std::move(metrics);
}
std::unique_ptr<base::ProcessMetrics> metrics);
~ProcessMetric();
};
namespace api {

View file

@ -21,6 +21,7 @@ namespace api {
class MenuMac : public Menu {
protected:
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
~MenuMac() override;
void PopupAt(TopLevelWindow* window,
int x,

View file

@ -25,6 +25,8 @@ MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
weak_factory_(this) {
}
MenuMac::~MenuMac() = default;
void MenuMac::PopupAt(TopLevelWindow* window,
int x, int y, int positioning_item,
const base::Closure& callback) {

View file

@ -17,6 +17,8 @@ namespace api {
MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
: Menu(isolate, wrapper), weak_factory_(this) {}
MenuViews::~MenuViews() = default;
void MenuViews::PopupAt(TopLevelWindow* window,
int x,
int y,

View file

@ -19,6 +19,7 @@ namespace api {
class MenuViews : public Menu {
public:
MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
~MenuViews() override;
protected:
void PopupAt(TopLevelWindow* window,

View file

@ -27,6 +27,8 @@ FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
source_id_for_copy_request_(base::UnguessableToken::Create()),
weak_factory_(this) {}
FrameSubscriber::~FrameSubscriber() = default;
bool FrameSubscriber::ShouldCaptureFrame(
const gfx::Rect& dirty_rect,
base::TimeTicks present_time,

View file

@ -27,6 +27,7 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
content::RenderWidgetHostView* view,
const FrameCaptureCallback& callback,
bool only_dirty);
~FrameSubscriber() override;
bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
base::TimeTicks present_time,

View file

@ -28,6 +28,7 @@ constexpr int kUserWantsNoMoreDialogs = -1;
AtomJavaScriptDialogManager::AtomJavaScriptDialogManager(
api::WebContents* api_web_contents)
: api_web_contents_(api_web_contents) {}
AtomJavaScriptDialogManager::~AtomJavaScriptDialogManager() = default;
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,

View file

@ -19,6 +19,7 @@ class WebContents;
class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
public:
explicit AtomJavaScriptDialogManager(api::WebContents* api_web_contents);
~AtomJavaScriptDialogManager() override;
// content::JavaScriptDialogManager implementations.
void RunJavaScriptDialog(content::WebContents* web_contents,

View file

@ -8,6 +8,9 @@
namespace atom {
BridgeTaskRunner::BridgeTaskRunner() = default;
BridgeTaskRunner::~BridgeTaskRunner() = default;
void BridgeTaskRunner::MessageLoopIsReady() {
auto* message_loop = base::MessageLoop::current();
CHECK(message_loop);

View file

@ -18,7 +18,7 @@ namespace atom {
// otherwise delay the work until message loop is ready.
class BridgeTaskRunner : public base::SingleThreadTaskRunner {
public:
BridgeTaskRunner() {}
BridgeTaskRunner();
// Called when message loop is ready.
void MessageLoopIsReady();
@ -35,7 +35,7 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
private:
using TaskPair =
std::tuple<base::Location, base::OnceClosure, base::TimeDelta>;
~BridgeTaskRunner() override {}
~BridgeTaskRunner() override;
std::vector<TaskPair> tasks_;
std::vector<TaskPair> non_nestable_tasks_;

View file

@ -21,6 +21,11 @@
namespace atom {
Browser::LoginItemSettings::LoginItemSettings() = default;
Browser::LoginItemSettings::~LoginItemSettings() = default;
Browser::LoginItemSettings::LoginItemSettings(
const LoginItemSettings& other) = default;
Browser::Browser()
: is_quiting_(false),
is_exiting_(false),

View file

@ -100,6 +100,10 @@ class Browser : public WindowListObserver {
bool opened_as_hidden = false;
base::string16 path;
std::vector<base::string16> args;
LoginItemSettings();
~LoginItemSettings();
LoginItemSettings(const LoginItemSettings&);
};
void SetLoginItemSettings(LoginItemSettings settings);
LoginItemSettings GetLoginItemSettings(const LoginItemSettings& options);

View file

@ -29,6 +29,8 @@ JavascriptEnvironment::JavascriptEnvironment()
context_(isolate_, v8::Context::New(isolate_)),
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {}
JavascriptEnvironment::~JavascriptEnvironment() = default;
void JavascriptEnvironment::OnMessageLoopCreated() {
isolate_holder_.AddRunMicrotasksObserver();
}

View file

@ -19,6 +19,7 @@ namespace atom {
class JavascriptEnvironment {
public:
JavascriptEnvironment();
~JavascriptEnvironment();
void OnMessageLoopCreated();
void OnMessageLoopDestroying();

View file

@ -34,6 +34,10 @@ struct Transaction {
std::string errorMessage = "";
std::string transactionState = "";
Payment payment;
Transaction();
Transaction(const Transaction&);
~Transaction();
};
// --------------------------- Classes ---------------------------

View file

@ -174,6 +174,10 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
namespace in_app_purchase {
Transaction::Transaction() = default;
Transaction::Transaction(const Transaction&) = default;
Transaction::~Transaction() = default;
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
obeserver_ = [[InAppTransactionObserver alloc]
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,

View file

@ -30,6 +30,10 @@ struct Product {
// Downloadable Content Information
bool downloadable = false;
Product(const Product&);
Product();
~Product();
};
// --------------------------- Typedefs ---------------------------

View file

@ -160,6 +160,10 @@
namespace in_app_purchase {
Product::Product() = default;
Product::Product(const Product&) = default;
Product::~Product() = default;
void GetProducts(const std::vector<std::string>& productIDs,
const InAppPurchaseProductsCallback& callback) {
auto* iapProduct = [[InAppPurchaseProduct alloc] initWithCallback:callback];

View file

@ -505,4 +505,9 @@ void NativeWindow::NotifyWindowMessage(UINT message,
}
#endif
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
: key(UserDataKey()), window(window) {}
NativeWindowRelay::~NativeWindowRelay() = default;
} // namespace atom

View file

@ -323,8 +323,8 @@ class NativeWindow : public base::SupportsUserData {
class NativeWindowRelay
: public content::WebContentsUserData<NativeWindowRelay> {
public:
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window)
: key(UserDataKey()), window(window) {}
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
~NativeWindowRelay() override;
static void* UserDataKey() {
return content::WebContentsUserData<NativeWindowRelay>::UserDataKey();

View file

@ -19,6 +19,10 @@ using content::BrowserThread;
namespace atom {
VerifyRequestParams::VerifyRequestParams() = default;
VerifyRequestParams::~VerifyRequestParams() = default;
VerifyRequestParams::VerifyRequestParams(const VerifyRequestParams&) = default;
namespace {
class Response : public base::LinkNode<Response> {

View file

@ -26,6 +26,10 @@ struct VerifyRequestParams {
std::string default_result;
int error_code;
scoped_refptr<net::X509Certificate> certificate;
VerifyRequestParams();
VerifyRequestParams(const VerifyRequestParams&);
~VerifyRequestParams();
};
class AtomCertVerifier : public net::CertVerifier {

View file

@ -217,6 +217,18 @@ void ReadFromResponseObject(const base::DictionaryValue& response,
} // namespace
AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo(
URLPatterns patterns_,
SimpleListener listener_): url_patterns(patterns_), listener(listener_) {}
AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo() = default;
AtomNetworkDelegate::SimpleListenerInfo::~SimpleListenerInfo() = default;
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo(
URLPatterns patterns_,
ResponseListener listener_): url_patterns(patterns_), listener(listener_) {}
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo() = default;
AtomNetworkDelegate::ResponseListenerInfo::~ResponseListenerInfo() = default;
AtomNetworkDelegate::AtomNetworkDelegate() {}
AtomNetworkDelegate::~AtomNetworkDelegate() {}

View file

@ -51,11 +51,19 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
struct SimpleListenerInfo {
URLPatterns url_patterns;
SimpleListener listener;
SimpleListenerInfo(URLPatterns, SimpleListener);
SimpleListenerInfo();
~SimpleListenerInfo();
};
struct ResponseListenerInfo {
URLPatterns url_patterns;
ResponseListener listener;
ResponseListenerInfo(URLPatterns, ResponseListener);
ResponseListenerInfo();
~ResponseListenerInfo();
};
AtomNetworkDelegate();

View file

@ -31,6 +31,8 @@ URLRequestBufferJob::URLRequestBufferJob(net::URLRequest* request,
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate),
status_code_(net::HTTP_NOT_IMPLEMENTED) {}
URLRequestBufferJob::~URLRequestBufferJob() = default;
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::Value* binary = nullptr;
if (options->IsType(base::Value::Type::DICTIONARY)) {

View file

@ -17,6 +17,7 @@ namespace atom {
class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
public:
URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*);
~URLRequestBufferJob() override;
// JsAsker:
void StartAsync(std::unique_ptr<base::Value> options) override;

View file

@ -83,6 +83,8 @@ URLRequestFetchJob::URLRequestFetchJob(net::URLRequest* request,
pending_buffer_size_(0),
write_num_bytes_(0) {}
URLRequestFetchJob::~URLRequestFetchJob() = default;
void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
mate::Dictionary options;

View file

@ -20,6 +20,7 @@ class URLRequestFetchJob : public JsAsker<net::URLRequestJob>,
public brightray::URLRequestContextGetter::Delegate {
public:
URLRequestFetchJob(net::URLRequest*, net::NetworkDelegate*);
~URLRequestFetchJob() override;
// Called by response writer.
void HeadersCompleted();

View file

@ -28,6 +28,8 @@ URLRequestStreamJob::URLRequestStreamJob(net::URLRequest* request,
response_headers_(nullptr),
weak_factory_(this) {}
URLRequestStreamJob::~URLRequestStreamJob() = default;
void URLRequestStreamJob::BeforeStartInUI(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
if (value->IsNull() || value->IsUndefined() || !value->IsObject()) {

View file

@ -23,6 +23,7 @@ class URLRequestStreamJob : public JsAsker<net::URLRequestJob> {
public:
URLRequestStreamJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate);
~URLRequestStreamJob() override;
void OnData(mate::Arguments* args);
void OnEnd(mate::Arguments* args);

View file

@ -15,6 +15,8 @@ URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate)
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate) {}
URLRequestStringJob::~URLRequestStringJob() = default;
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
if (options->IsType(base::Value::Type::DICTIONARY)) {
base::DictionaryValue* dict =

View file

@ -15,6 +15,7 @@ namespace atom {
class URLRequestStringJob : public JsAsker<net::URLRequestSimpleJob> {
public:
URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*);
~URLRequestStringJob() override;
// JsAsker:
void StartAsync(std::unique_ptr<base::Value> options) override;

View file

@ -64,6 +64,9 @@ struct DialogSettings {
bool shows_tag_field = true;
bool force_detached = false;
bool security_scoped_bookmarks = false;
DialogSettings();
~DialogSettings();
};
bool ShowOpenDialog(const DialogSettings& settings,

View file

@ -17,6 +17,9 @@
namespace file_dialog {
DialogSettings::DialogSettings() = default;
DialogSettings::~DialogSettings() = default;
namespace {
// Makes sure that .jpg also shows .JPG.

View file

@ -69,6 +69,9 @@
namespace file_dialog {
DialogSettings::DialogSettings() = default;
DialogSettings::~DialogSettings() = default;
namespace {
void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {

View file

@ -25,6 +25,9 @@
namespace file_dialog {
DialogSettings::DialogSettings() = default;
DialogSettings::~DialogSettings() = default;
namespace {
// Distinguish directories from regular files.

View file

@ -23,6 +23,9 @@ const int kDefaultHeight = 300;
} // namespace
SetSizeParams::SetSizeParams() = default;
SetSizeParams::~SetSizeParams() = default;
WebViewGuestDelegate::WebViewGuestDelegate()
: embedder_zoom_controller_(nullptr),
guest_host_(nullptr),

View file

@ -22,8 +22,8 @@ class WebContents;
// meaningful. This is because the normal size of the guestview is overridden
// whenever autosizing occurs.
struct SetSizeParams {
SetSizeParams() {}
~SetSizeParams() {}
SetSizeParams();
~SetSizeParams();
std::unique_ptr<bool> enable_auto_size;
std::unique_ptr<gfx::Size> min_size;

View file

@ -237,6 +237,8 @@ SpellCheckClient::SpellCheckScope::SpellCheckScope(
provider_(client.provider_.NewHandle()),
spell_check_(client.spell_check_.NewHandle()) {}
SpellCheckClient::SpellCheckScope::~SpellCheckScope() = default;
} // namespace api
} // namespace atom

View file

@ -60,6 +60,7 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient,
v8::Local<v8::Function> spell_check_;
explicit SpellCheckScope(const SpellCheckClient& client);
~SpellCheckScope();
};
// Check the spelling of text.

View file

@ -57,6 +57,8 @@ AutofillAgent::AutofillAgent(content::RenderFrame* frame)
render_frame()->GetWebFrame()->SetAutofillClient(this);
}
AutofillAgent::~AutofillAgent() = default;
void AutofillAgent::OnDestruct() {
delete this;
}

View file

@ -21,6 +21,7 @@ class AutofillAgent : public content::RenderFrameObserver,
public blink::WebAutofillClient {
public:
explicit AutofillAgent(content::RenderFrame* frame);
~AutofillAgent() override;
// content::RenderFrameObserver:
void OnDestruct() override;

View file

@ -9,6 +9,9 @@
namespace brightray {
NotificationOptions::NotificationOptions() = default;
NotificationOptions::~NotificationOptions() = default;
Notification::Notification(NotificationDelegate* delegate,
NotificationPresenter* presenter)
: delegate_(delegate), presenter_(presenter), weak_factory_(this) {}

View file

@ -36,6 +36,9 @@ struct NotificationOptions {
base::string16 sound;
std::vector<NotificationAction> actions;
base::string16 close_button_text;
NotificationOptions();
~NotificationOptions();
};
class Notification {

View file

@ -11,8 +11,10 @@ TtsUtteranceRequest::~TtsUtteranceRequest() {}
TtsVoice::TtsVoice() : local_service(true), is_default(false) {}
TtsVoice::TtsVoice(const TtsVoice&) = default;
TtsVoice::~TtsVoice() {}
TtsUtteranceResponse::TtsUtteranceResponse() : id(0) {}
TtsUtteranceResponse::~TtsUtteranceResponse() {}
TtsUtteranceResponse::~TtsUtteranceResponse() {}

View file

@ -25,6 +25,7 @@ struct TtsUtteranceRequest {
struct TtsVoice {
TtsVoice();
TtsVoice(const TtsVoice&);
~TtsVoice();
std::string voice_uri;