mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 15:32:10 +08:00
1aa478d161
This change was partially scripted and partially done manually with vim regex + manually placing the deleted constructors. The script change looked for destructors in the public: section of a class, if that existed the deleted constructors would go before the destructor. For manual placement I looked for any constructor in the public: section of the corresponding class. If there wasn't one, then it would ideally have gone as the first entry except below enums, classes and typedefs. This may not have been perfect, but is hopefully good enough. Fingers crossed. #include "base/macros.h" is removed from files that don't use ignore_result, which is the only other thing defined in base/macros.h. Bug: chromium:1010217 Change-Id: I099526255a40b1ac1264904b4ece2f3f503c9418 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3171034 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Peter Boström <pbos@chromium.org>
115 lines
4.1 KiB
C++
115 lines
4.1 KiB
C++
// Copyright 2017 The Crashpad Authors. All rights reserved.
|
||
//
|
||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||
// you may not use this file except in compliance with the License.
|
||
// You may obtain a copy of the License at
|
||
//
|
||
// http://www.apache.org/licenses/LICENSE-2.0
|
||
//
|
||
// Unless required by applicable law or agreed to in writing, software
|
||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
// See the License for the specific language governing permissions and
|
||
// limitations under the License.
|
||
|
||
#ifndef CRASHPAD_MINIDUMP_MINIDUMP_ANNOTATION_WRITER_H_
|
||
#define CRASHPAD_MINIDUMP_MINIDUMP_ANNOTATION_WRITER_H_
|
||
|
||
#include <memory>
|
||
#include <vector>
|
||
|
||
#include "minidump/minidump_byte_array_writer.h"
|
||
#include "minidump/minidump_extensions.h"
|
||
#include "minidump/minidump_string_writer.h"
|
||
#include "minidump/minidump_writable.h"
|
||
#include "snapshot/annotation_snapshot.h"
|
||
|
||
namespace crashpad {
|
||
|
||
//! \brief The writer for a MinidumpAnnotation object in a minidump file.
|
||
//!
|
||
//! Because MinidumpAnnotation objects only appear as elements
|
||
//! of MinidumpAnnotationList objects, this class does not write any
|
||
//! data on its own. It makes its MinidumpAnnotation data available to its
|
||
//! MinidumpAnnotationList parent, which writes it as part of a
|
||
//! MinidumpAnnotationList.
|
||
class MinidumpAnnotationWriter final : public internal::MinidumpWritable {
|
||
public:
|
||
MinidumpAnnotationWriter();
|
||
|
||
MinidumpAnnotationWriter(const MinidumpAnnotationWriter&) = delete;
|
||
MinidumpAnnotationWriter& operator=(const MinidumpAnnotationWriter&) = delete;
|
||
|
||
~MinidumpAnnotationWriter();
|
||
|
||
//! \brief Initializes the annotation writer with data from an
|
||
//! AnnotationSnapshot.
|
||
void InitializeFromSnapshot(const AnnotationSnapshot& snapshot);
|
||
|
||
//! \brief Initializes the annotation writer with data values.
|
||
void InitializeWithData(const std::string& name,
|
||
uint16_t type,
|
||
const std::vector<uint8_t>& data);
|
||
|
||
//! \brief Returns the MinidumpAnnotation referencing this object’s data.
|
||
const MinidumpAnnotation* minidump_annotation() const { return &annotation_; }
|
||
|
||
protected:
|
||
// MinidumpWritable:
|
||
|
||
bool Freeze() override;
|
||
size_t SizeOfObject() override;
|
||
std::vector<internal::MinidumpWritable*> Children() override;
|
||
bool WriteObject(FileWriterInterface* file_writer) override;
|
||
|
||
private:
|
||
MinidumpAnnotation annotation_;
|
||
internal::MinidumpUTF8StringWriter name_;
|
||
MinidumpByteArrayWriter value_;
|
||
};
|
||
|
||
//! \brief The writer for a MinidumpAnnotationList object in a minidump file,
|
||
//! containing a list of MinidumpAnnotation objects.
|
||
class MinidumpAnnotationListWriter final : public internal::MinidumpWritable {
|
||
public:
|
||
MinidumpAnnotationListWriter();
|
||
|
||
MinidumpAnnotationListWriter(const MinidumpAnnotationListWriter&) = delete;
|
||
MinidumpAnnotationListWriter& operator=(const MinidumpAnnotationListWriter&) =
|
||
delete;
|
||
|
||
~MinidumpAnnotationListWriter();
|
||
|
||
//! \brief Initializes the annotation list writer with a list of
|
||
//! AnnotationSnapshot objects.
|
||
void InitializeFromList(const std::vector<AnnotationSnapshot>& list);
|
||
|
||
//! \brief Adds a single MinidumpAnnotationWriter to the list to be written.
|
||
void AddObject(std::unique_ptr<MinidumpAnnotationWriter> annotation_writer);
|
||
|
||
//! \brief Determines whether the object is useful.
|
||
//!
|
||
//! A useful object is one that carries data that makes a meaningful
|
||
//! contribution to a minidump file. An object carrying entries would be
|
||
//! considered useful.
|
||
//!
|
||
//! \return `true` if the object is useful, `false` otherwise.
|
||
bool IsUseful() const;
|
||
|
||
protected:
|
||
// MinidumpWritable:
|
||
|
||
bool Freeze() override;
|
||
size_t SizeOfObject() override;
|
||
std::vector<internal::MinidumpWritable*> Children() override;
|
||
bool WriteObject(FileWriterInterface* file_writer) override;
|
||
|
||
private:
|
||
std::unique_ptr<MinidumpAnnotationList> minidump_list_;
|
||
std::vector<std::unique_ptr<MinidumpAnnotationWriter>> objects_;
|
||
};
|
||
|
||
} // namespace crashpad
|
||
|
||
#endif // CRASHPAD_MINIDUMP_MINIDUMP_ANNOTATION_WRITER_H_
|