| Differences between
and this patch
- a/Source/WebCore/ChangeLog +24 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-05-04  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Convert OwnPtr to std::unique_ptr in CDM
4
        https://bugs.webkit.org/show_bug.cgi?id=132467
5
6
        Reviewed by Andreas Kling.
7
8
        Use std::unique_ptr in CDM class.
9
10
        No new tests, no behavior change.
11
12
        * Modules/encryptedmedia/CDM.cpp:
13
        (WebCore::CDM::create):
14
        (WebCore::CDM::CDM):
15
        * Modules/encryptedmedia/CDM.h:
16
        * Modules/encryptedmedia/CDMPrivateMediaPlayer.h:
17
        (WebCore::CDMPrivateMediaPlayer::CDMPrivateMediaPlayer):
18
        (WebCore::CDMPrivateMediaPlayer::create):
19
        * Modules/encryptedmedia/MediaKeys.cpp:
20
        (WebCore::MediaKeys::create):
21
        (WebCore::MediaKeys::MediaKeys):
22
        * Modules/encryptedmedia/MediaKeys.h:
23
        * WebCore.exp.in:
24
1
2014-05-03  Commit Queue  <commit-queue@webkit.org>
25
2014-05-03  Commit Queue  <commit-queue@webkit.org>
2
26
3
        Unreviewed, rolling out r168232.
27
        Unreviewed, rolling out r168232.
- a/Source/WebCore/Modules/encryptedmedia/CDM.cpp -3 / +3 lines
Lines 94-112 bool CDM::keySystemSupportsMimeType(const String& keySystem, const String& mimeT a/Source/WebCore/Modules/encryptedmedia/CDM.cpp_sec1
94
    return false;
94
    return false;
95
}
95
}
96
96
97
PassOwnPtr<CDM> CDM::create(const String& keySystem)
97
std::unique_ptr<CDM> CDM::create(const String& keySystem)
98
{
98
{
99
    if (!supportsKeySystem(keySystem))
99
    if (!supportsKeySystem(keySystem))
100
        return nullptr;
100
        return nullptr;
101
101
102
    return adoptPtr(new CDM(keySystem));
102
    return std::make_unique<CDM>(keySystem);
103
}
103
}
104
104
105
CDM::CDM(const String& keySystem)
105
CDM::CDM(const String& keySystem)
106
    : m_keySystem(keySystem)
106
    : m_keySystem(keySystem)
107
    , m_client(0)
107
    , m_client(0)
108
{
108
{
109
    m_private = CDMFactoryForKeySystem(keySystem)->constructor(this);
109
    m_private = std::move(CDMFactoryForKeySystem(keySystem)->constructor(this));
110
}
110
}
111
111
112
CDM::~CDM()
112
CDM::~CDM()
- a/Source/WebCore/Modules/encryptedmedia/CDM.h -5 / +4 lines
Lines 40-46 class CDM; a/Source/WebCore/Modules/encryptedmedia/CDM.h_sec1
40
class CDMPrivateInterface;
40
class CDMPrivateInterface;
41
class MediaPlayer;
41
class MediaPlayer;
42
42
43
typedef PassOwnPtr<CDMPrivateInterface> (*CreateCDM)(CDM*);
43
typedef std::unique_ptr<CDMPrivateInterface> (*CreateCDM)(CDM*);
44
typedef bool (*CDMSupportsKeySystem)(const String&);
44
typedef bool (*CDMSupportsKeySystem)(const String&);
45
typedef bool (*CDMSupportsKeySystemAndMimeType)(const String&, const String&);
45
typedef bool (*CDMSupportsKeySystemAndMimeType)(const String&, const String&);
46
46
Lines 53-63 public: a/Source/WebCore/Modules/encryptedmedia/CDM.h_sec2
53
53
54
class CDM {
54
class CDM {
55
public:
55
public:
56
    explicit CDM(const String& keySystem);
56
57
57
    enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
58
    enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
58
    static bool supportsKeySystem(const String&);
59
    static bool supportsKeySystem(const String&);
59
    static bool keySystemSupportsMimeType(const String& keySystem, const String& mimeType);
60
    static bool keySystemSupportsMimeType(const String& keySystem, const String& mimeType);
60
    static PassOwnPtr<CDM> create(const String& keySystem);
61
    static std::unique_ptr<CDM> create(const String& keySystem);
61
    static void registerCDMFactory(CreateCDM, CDMSupportsKeySystem, CDMSupportsKeySystemAndMimeType);
62
    static void registerCDMFactory(CreateCDM, CDMSupportsKeySystem, CDMSupportsKeySystemAndMimeType);
62
    ~CDM();
63
    ~CDM();
63
64
Lines 72-81 public: a/Source/WebCore/Modules/encryptedmedia/CDM.h_sec3
72
    MediaPlayer* mediaPlayer() const;
73
    MediaPlayer* mediaPlayer() const;
73
74
74
private:
75
private:
75
    CDM(const String& keySystem);
76
77
    String m_keySystem;
76
    String m_keySystem;
78
    OwnPtr<CDMPrivateInterface> m_private;
77
    std::unique_ptr<CDMPrivateInterface> m_private;
79
    CDMClient* m_client;
78
    CDMClient* m_client;
80
};
79
};
81
80
- a/Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h -2 / +5 lines
Lines 38-44 class CDM; a/Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h_sec1
38
38
39
class CDMPrivateMediaPlayer : public CDMPrivateInterface {
39
class CDMPrivateMediaPlayer : public CDMPrivateInterface {
40
public:
40
public:
41
    static PassOwnPtr<CDMPrivateInterface> create(CDM* cdm) { return adoptPtr(new CDMPrivateMediaPlayer(cdm)); }
41
    explicit CDMPrivateMediaPlayer(CDM* cdm)
42
        : m_cdm(cdm)
43
    { }
44
45
    static std::unique_ptr<CDMPrivateInterface> create(CDM* cdm) { return std::make_unique<CDMPrivateMediaPlayer>(cdm); }
42
    static bool supportsKeySystem(const String&);
46
    static bool supportsKeySystem(const String&);
43
    static bool supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType);
47
    static bool supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType);
44
48
Lines 50-56 public: a/Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h_sec2
50
    CDM* cdm() const { return m_cdm; }
54
    CDM* cdm() const { return m_cdm; }
51
55
52
protected:
56
protected:
53
    CDMPrivateMediaPlayer(CDM* cdm) : m_cdm(cdm) { }
54
    CDM* m_cdm;
57
    CDM* m_cdm;
55
};
58
};
56
59
- a/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp -4 / +4 lines
Lines 57-74 PassRefPtr<MediaKeys> MediaKeys::create(const String& keySystem, ExceptionCode& a/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp_sec1
57
57
58
    // 3. Let cdm be the content decryption module corresponding to keySystem.
58
    // 3. Let cdm be the content decryption module corresponding to keySystem.
59
    // 4. Load cdm if necessary.
59
    // 4. Load cdm if necessary.
60
    OwnPtr<CDM> cdm = CDM::create(keySystem);
60
    std::unique_ptr<CDM> cdm = CDM::create(keySystem);
61
61
62
    // 5. Create a new MediaKeys object.
62
    // 5. Create a new MediaKeys object.
63
    // 5.1 Let the keySystem attribute be keySystem.
63
    // 5.1 Let the keySystem attribute be keySystem.
64
    // 6. Return the new object to the caller.
64
    // 6. Return the new object to the caller.
65
    return adoptRef(new MediaKeys(keySystem, cdm.release()));
65
    return adoptRef(new MediaKeys(keySystem, std::move(cdm)));
66
}
66
}
67
67
68
MediaKeys::MediaKeys(const String& keySystem, PassOwnPtr<CDM> cdm)
68
MediaKeys::MediaKeys(const String& keySystem, std::unique_ptr<CDM> cdm)
69
    : m_mediaElement(0)
69
    : m_mediaElement(0)
70
    , m_keySystem(keySystem)
70
    , m_keySystem(keySystem)
71
    , m_cdm(cdm)
71
    , m_cdm(std::move(cdm))
72
{
72
{
73
    m_cdm->setClient(this);
73
    m_cdm->setClient(this);
74
}
74
}
- a/Source/WebCore/Modules/encryptedmedia/MediaKeys.h -3 / +2 lines
Lines 32-38 a/Source/WebCore/Modules/encryptedmedia/MediaKeys.h_sec1
32
#include "EventTarget.h"
32
#include "EventTarget.h"
33
#include "ExceptionCode.h"
33
#include "ExceptionCode.h"
34
#include <runtime/Uint8Array.h>
34
#include <runtime/Uint8Array.h>
35
#include <wtf/OwnPtr.h>
36
#include <wtf/PassRefPtr.h>
35
#include <wtf/PassRefPtr.h>
37
#include <wtf/RefCounted.h>
36
#include <wtf/RefCounted.h>
38
#include <wtf/Vector.h>
37
#include <wtf/Vector.h>
Lines 62-74 protected: a/Source/WebCore/Modules/encryptedmedia/MediaKeys.h_sec2
62
    // CDMClient:
61
    // CDMClient:
63
    virtual MediaPlayer* cdmMediaPlayer(const CDM*) const override;
62
    virtual MediaPlayer* cdmMediaPlayer(const CDM*) const override;
64
63
65
    MediaKeys(const String& keySystem, PassOwnPtr<CDM>);
64
    MediaKeys(const String& keySystem, std::unique_ptr<CDM>);
66
65
67
    Vector<RefPtr<MediaKeySession>> m_sessions;
66
    Vector<RefPtr<MediaKeySession>> m_sessions;
68
67
69
    HTMLMediaElement* m_mediaElement;
68
    HTMLMediaElement* m_mediaElement;
70
    String m_keySystem;
69
    String m_keySystem;
71
    OwnPtr<CDM> m_cdm;
70
    std::unique_ptr<CDM> m_cdm;
72
};
71
};
73
72
74
}
73
}
- a/Source/WebCore/WebCore.exp.in -1 / +1 lines
Lines 2938-2944 __ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationENS_20 a/Source/WebCore/WebCore.exp.in_sec1
2938
#endif
2938
#endif
2939
2939
2940
#if ENABLE(ENCRYPTED_MEDIA_V2)
2940
#if ENABLE(ENCRYPTED_MEDIA_V2)
2941
__ZN7WebCore3CDM18registerCDMFactoryEPFN3WTF10PassOwnPtrINS_19CDMPrivateInterfaceEEEPS0_EPFbRKNS1_6StringEEPFbSA_SA_E
2941
__ZN7WebCore3CDM18registerCDMFactoryEPFNSt3__110unique_ptrINS_19CDMPrivateInterfaceENS1_14default_deleteIS3_EEEEPS0_EPFbRKN3WTF6StringEEPFbSD_SD_E
2942
#endif
2942
#endif
2943
2943
2944
#if ENABLE(FULLSCREEN_API)
2944
#if ENABLE(FULLSCREEN_API)
- a/Source/WebCore/testing/MockCDM.h -3 / +5 lines
Lines 29-35 a/Source/WebCore/testing/MockCDM.h_sec1
29
#if ENABLE(ENCRYPTED_MEDIA_V2)
29
#if ENABLE(ENCRYPTED_MEDIA_V2)
30
30
31
#include "CDMPrivate.h"
31
#include "CDMPrivate.h"
32
#include <wtf/PassOwnPtr.h>
33
32
34
namespace WebCore {
33
namespace WebCore {
35
34
Lines 37-44 class CDM; a/Source/WebCore/testing/MockCDM.h_sec2
37
36
38
class MockCDM : public CDMPrivateInterface {
37
class MockCDM : public CDMPrivateInterface {
39
public:
38
public:
39
    explicit MockCDM(CDM* cdm)
40
        : m_cdm(cdm)
41
    { }
42
40
    // CDMFactory support:
43
    // CDMFactory support:
41
    static PassOwnPtr<CDMPrivateInterface> create(CDM* cdm) { return adoptPtr(new MockCDM(cdm)); }
44
    static std::unique_ptr<CDMPrivateInterface> create(CDM* cdm) { return std::make_unique<MockCDM>(cdm); }
42
    static bool supportsKeySystem(const String&);
45
    static bool supportsKeySystem(const String&);
43
    static bool supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType);
46
    static bool supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType);
44
47
Lines 48-54 public: a/Source/WebCore/testing/MockCDM.h_sec3
48
    virtual std::unique_ptr<CDMSession> createSession() override;
51
    virtual std::unique_ptr<CDMSession> createSession() override;
49
52
50
protected:
53
protected:
51
    MockCDM(CDM* cdm) : m_cdm(cdm) { }
52
    CDM* m_cdm;
54
    CDM* m_cdm;
53
};
55
};
54
56

Return to Bug 132467