IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Autres éditeurs Discussion :

Probleme lors de la creation dune nouvelle classe cpp en utilisant XCODE


Sujet :

Autres éditeurs

  1. #1
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut Probleme lors de la creation dune nouvelle classe cpp en utilisant XCODE
    Je recois une erreur chaque fois que je cree une nouvelle classe en utilisant XCode. Je narrive pas a BUILD correctement je recois le message BUILD FAILED et je recois les erreurs suivantes: 10 erreurs de type Parse issue- 10 erreurs de type sematic issue,

    pour les sematic issue je recois les erreurs in file .....in file .....in file .... avec les files dans lesquelles les erreurs se situent. Pour les erreurs sematic je recois lerreur suivante: expanded from macro 'new'/ expanded from macro 'delete'.

    Pour les parse issue, je recois les memes erreurs in file.... in file.... avec les directories dans lesquelles les erreurs se situent avec les memes messages: expanded from macro new, expanded from macro delete. Est ce que vous pourriez maider je narrive pas a creer de nouvelle classe.
    Images attachées Images attachées  

  2. #2
    Membre habitué

    Inscrit en
    Avril 2011
    Messages
    55
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 55
    Points : 147
    Points
    147
    Par défaut
    Bonjour, deux questions :
    • fais-tu des modifications sur le code généré ?
    • est-ce qu'il t'est possible de nous montrer le code ?

    Sans plus d'informations il est difficile de te répondre.

  3. #3
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut Webkit
    Je travaille sur Webkit et le seul truc que jai fait cest que jai cree une nouvelle classe MinimizerController.cpp et MinimizerController.h est ce que tu pourais mindiquer les erreurs a suivre pour resoudre ce probleme. Cette erreur est celle que je recois a travers la command line. Mais je nai pas du tout modifie le code genere;
    pcp329103pcs:timelapse mouna$ Tools/Scripts/run-safari
    Can't find built framework at "/Users/mouna/repos/timelapse/WebKitBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore".
    Images attachées Images attachées  

  4. #4
    Membre habitué

    Inscrit en
    Avril 2011
    Messages
    55
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 55
    Points : 147
    Points
    147
    Par défaut
    Bon visiblement tu passe à un moment un const char* (cf. première image) alors que l'API attend une sorte de pointeur sur fonction (cf. deuxième image).
    Existe-il un type proposé par l'API pour les chaînes de caractères ?

  5. #5
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut minimisation d'un enregistrement pour tester des applications web
    Bonjour,

    Je suis vraiment perdue, s'il vous plait aidez moi! Je vous presente ma situation: J'ai un programme qui est deja code. Ce programme permet de tester des applications web a travers une infrastructure de replay recording (ENREGISTRER/VISIONNER). Donc, j'ai acces a toutes la sequence devenement qui est enregistree. Cette sequence est enregistree au fur et a mesure que je saisis des inputs au niveau d'une web application. J'aimerais minimiser un emregistrement de maniere a le couper en deux. Je ne veux que visionner la moitie de la sequence dactions et devenements performes au nieau de la page web au lieu de visionner l'enregistrement entier des actions que j'ai performe. Est ce que vous pourriez m'aider. Je travaille sur webkit et j'inclue toutes les classes ignificatives pour l'implementation de la minimization en deux. Je veux visionner que la premiere partie de lenregistrement et je ne veux pas que la deuxieme moitie soit visionnee. Merci L'infrastructure presente permet de visionner un enregistrement performe par ll'utilisateur au niveau d'une page web en entier, je dois tout simplement modifier certains fichiers pour permettre le visionnement de la premiere moitie.Excusez moi je sais que ca fait beaucoup de code et de classes mais ceci nest pas mon code, il a ete code par quelqun dautre cest pour ca que je suis perdue, de plus je n'ai jamais etudie C++, sil vous plait aidez moi. Merci beaucoup, vous me sauvez la vie. Je vous envoie un fichier zip avec toutes les files cpp et leur .h correspondante. Je vous en supplie aidez moi merci, vous me sauvrez la vie
    Fichiers attachés Fichiers attachés

  6. #6
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    /*
    * Copyright (C) 2013 University of Washington. All rights reserved.
    * Copyright (C) 2014 Apple Inc. All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
    * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    * THE POSSIBILITY OF SUCH DAMAGE.
    */
     
    WebInspector.ReplayManager = function()
    {
    WebInspector.Object.call(this);
     
    this._sessionState = WebInspector.ReplayManager.SessionState.Inactive;
    this._segmentState = WebInspector.ReplayManager.SegmentState.Unloaded;
     
    this._activeSessionIdentifier = null;
    this._activeSegmentIdentifier = null;
    this._currentPosition = new WebInspector.ReplayPosition(0, 0);
     
    // These hold actual instances of sessions and segments.
    this._sessions = new Map;
    this._segments = new Map;
    // These hold promises that resolve when the instance data is recieved.
    this._sessionPromises = new Map;
    this._segmentPromises = new Map;
     
    // Playback speed is specified in replayToPosition commands, and persists
    // for the duration of the playback command until another playback begins.
    this._playbackSpeed = WebInspector.ReplayManager.PlaybackSpeed.RealTime;
     
    if (!window.ReplayAgent)
    return;
     
    ReplayAgent.getAvailableSessions.promise()
    .then(function(sessionIds) {
    for (var sessionId of sessionIds)
    WebInspector.replayManager.sessionCreated(sessionId);
    });
    };
     
    WebInspector.ReplayManager.Event = {
    CaptureStarted: "replay-manager-capture-started",
    CaptureStopped: "replay-manager-capture-stopped",
     
    PlaybackStarted: "replay-manager-playback-started",
    PlaybackPaused: "replay-manager-playback-paused",
    PlaybackFinished: "replay-manager-playback-finished",
    PlaybackPositionChanged: "replay-manager-play-back-position-changed",
     
    ActiveSessionChanged: "replay-manager-active-session-changed",
    ActiveSegmentChanged: "replay-manager-active-segment-changed",
     
    SessionSegmentAdded: "replay-manager-session-segment-added",
    SessionSegmentRemoved: "replay-manager-session-segment-removed",
     
    SessionAdded: "replay-manager-session-added",
    SessionRemoved: "replay-manager-session-removed",
    };
     
    WebInspector.ReplayManager.SessionState = {
    Capturing: "replay-manager-session-state-capturing",
    Inactive: "replay-manager-session-state-inactive",
    Replaying: "replay-manager-session-state-replaying",
    };
     
    WebInspector.ReplayManager.SegmentState = {
    Appending: "replay-manager-segment-state-appending",
    Unloaded: "replay-manager-segment-state-unloaded",
    Loaded: "replay-manager-segment-state-loaded",
    Dispatching: "replay-manager-segment-state-dispatching",
    };
     
    WebInspector.ReplayManager.PlaybackSpeed = {
    RealTime: "replay-manager-playback-speed-real-time",
    FastForward: "replay-manager-playback-speed-fast-forward",
    };
     
    WebInspector.ReplayManager.prototype = {
    constructor: WebInspector.ReplayManager,
    __proto__: WebInspector.Object.prototype,
     
    // Public
     
    get sessionState()
    {
    return this._sessionState;
    },
     
    get segmentState()
    {
    return this._segmentState;
    },
     
    get activeSessionIdentifier()
    {
    return this._activeSessionIdentifier;
    },
     
    get activeSegmentIdentifier()
    {
    return this._activeSegmentIdentifier;
    },
     
    get playbackSpeed()
    {
    return this._playbackSpeed;
    },
     
    set playbackSpeed(value)
    {
    this._playbackSpeed = value;
    },
     
    get currentPosition()
    {
    return this._currentPosition;
    },
     
    // These return promises even if the relevant instance is already created.
    getSession: function(sessionId)
    {
    if (this._sessionPromises.has(sessionId))
    return this._sessionPromises.get(sessionId);
     
    var newPromise = ReplayAgent.getSerializedSession.promise(sessionId)
    .then(function(payload) {
    return Promise.resolve(WebInspector.ReplaySession.fromPayload(sessionId, payload));
    });
     
    this._sessionPromises.set(sessionId, newPromise);
    return newPromise;
    },
     
    getSegment: function(segmentId)
    {
    if (this._segmentPromises.has(segmentId))
    return this._segmentPromises.get(segmentId);
     
    var newPromise = ReplayAgent.getSerializedSegment.promise(segmentId)
    .then(function(payload) {
    return Promise.resolve(new WebInspector.ReplaySessionSegment(segmentId, payload));
    });
     
    this._segmentPromises.set(segmentId, newPromise);
    return newPromise;
    },
     
    // Protected (called by ReplayObserver)
     
    captureStarted: function()
    {
    this._changeSessionState(WebInspector.ReplayManager.SessionState.Capturing);
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.CaptureStarted);
    },
     
    captureStopped: function()
    {
    this._changeSessionState(WebInspector.ReplayManager.SessionState.Inactive);
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Unloaded);
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.CaptureStopped);
    },
     
    playbackStarted: function()
    {
    if (this.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
    this._changeSessionState(WebInspector.ReplayManager.SessionState.Replaying);
     
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Dispatching);
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackStarted);
    },
     
    playbackHitPosition: function(replayPosition, timestamp)
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching);
    console.assert(replayPosition instanceof WebInspector.ReplayPosition);
     
    this._currentPosition = replayPosition;
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackPositionChanged);
    },
     
    playbackPaused: function(mark)
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Loaded);
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackPaused);
    },
     
    playbackFinished: function()
    {
    this._changeSessionState(WebInspector.ReplayManager.SessionState.Inactive);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackFinished);
    },
     
    sessionCreated: function(sessionId)
    {
    console.assert(!this._sessions.has(sessionId), "Tried to add duplicate session identifier:", sessionId);
    var sessionMap = this._sessions;
    this.getSession(sessionId)
    .then(function(session) {
    sessionMap.set(sessionId, session);
    })
    .catch(function(error) {
    console.error("Error obtaining session data: ", error);
    });
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.SessionCreated, {sessionId: sessionId});
    },
     
    sessionModified: function(sessionId)
    {
    this.getSession(sessionId).then(function(session) {
    session.segmentsChanged();
    });
    },
     
    sessionRemoved: function(sessionId)
    {
    console.assert(this._sessions.has(sessionId), "Unknown session identifier:", sessionId);
     
    if (!this._sessionPromises.has(sessionId))
    return;
     
    var manager = this;
     
    // Wait for any outstanding promise to settle so it doesn't get re-added.
    this.getSession(sessionId)
    .catch(function(error) {
    return Promise.resolve();
    })
    .then(function() {
    manager._sessionPromises.delete(sessionId);
    var removedSession = manager._sessions.take(sessionId);
    console.assert(removedSession);
    manager.dispatchEventToListeners(WebInspector.ReplayManager.Event.SessionRemoved, {removedSession: removedSession});
    });
    },
     
    segmentCreated: function(segmentId)
    {
    console.assert(!this._segments.has(segmentId), "Tried to add duplicate segment identifier:", segmentId);
     
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Appending);
     
    // Create a dummy segment, and don't try to load any data for it. It will
    // be removed once the segment is complete, and then its data will be fetched.
    var incompleteSegment = new WebInspector.IncompleteSessionSegment(segmentId);
    this._segments.set(segmentId, incompleteSegment);
    this._segmentPromises.set(segmentId, Promise.resolve(incompleteSegment));
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.SegmentCreated, {segmentIdentifier: segmentId});
    },
     
    segmentCompleted: function(segmentId)
    {
    var placeholderSegment = this._segments.take(segmentId);
    console.assert(placeholderSegment instanceof WebInspector.IncompleteSessionSegment);
    this._segmentPromises.delete(segmentId);
     
    var segmentMap = this._segments;
    this.getSegment(segmentId)
    .then(function(segment) {
    segmentMap.set(segmentId, segment);
    })
    .catch(function(error) {
    console.error("Error obtaining segment data: ", error);
    });
    },
     
    segmentRemoved: function(segmentId)
    {
    console.assert(this._segments.has(segmentId), "Unknown segment identifier:", segmentId);
     
    if (!this._segmentPromises.has(segmentId))
    return;
     
    var manager = this;
     
    // Wait for any outstanding promise to settle so it doesn't get re-added.
    this.getSegment(segmentId)
    .catch(function(error) {
    return Promise.resolve();
    })
    .then(function() {
    manager._segmentPromises.delete(segmentId);
    var removedSegment = manager._segments.take(segmentId);
    console.assert(removedSegment);
    manager.dispatchEventToListeners(WebInspector.ReplayManager.Event.SessionSegmentRemoved, {removedSegment: removedSegment});
    });
    },
     
    segmentLoaded: function(segmentId)
    {
    console.assert(this._segments.has(segmentId), "Unknown segment identifier:", segmentId);
     
    console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Loaded);
     
    this._activeSegmentIdentifier = segmentId;
    this.dispatchEventToListeners(WebInspector.ReplayMxfanager.Event.SegmentLoaded);
    },
     
    segmentUnloaded: function()
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
    this._changeSegmentState(WebInspector.ReplayManager.SegmentState.Unloaded);
     
    var unloadedSegmentIdentifier = this._activeSegmentIdentifier;
    this._activeSegmentIdentifier = null;
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.segmentUnloaded, {unloadedSegmentIdentifier: unloadedSegmentIdentifier});
    },
     
    // Private
     
    // FIXME: these methods should be private and only accessed by implementations of the public API,
    // which should properly chain async calls leading up to these low-level backend calls. Otherwise,
    // their preconditions on session and segment state are too strong for scenarios triggered by the UI.
     
    startCapturing: function()
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Inactive);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
     
    ReplayAgent.startCapturing();
    },
     
    stopCapturing: function()
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Capturing);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Appending);
     
    ReplayAgent.stopCapturing();
    },
     
    replayToMarkIndex: function(replayPosition)
    {
    console.assert(replayPosition instanceof WebInspector.ReplayPosition);
     
    console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
    // FIXME: Once the public API is asynchronous, we should assert that segmentState is Loaded.
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackWillStart);
    ReplayAgent.replayToPosition(replayPosition, this.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward);
    },
     
    replayToCompletion: function()
    {
    console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
    // FIXME: Once the public API is asynchronous, we should assert that segmentState is Loaded.
     
    this.dispatchEventToListeners(WebInspector.ReplayManager.Event.PlaybackWillStart);
    ReplayAgent.replayToCompletion(this.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward);
    },
     
    pausePlayback: function()
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching);
     
    ReplayAgent.pausePlayback();
    },
     
    stopPlayback: function()
    {
    console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
    console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Loaded);
     
    ReplayAgent.stopPlayback();
    },
     
    // Private
     
    _changeSessionState: function(newState)
    {
    // Warn about no-op state changes. We shouldn't be seeing them.
    var isAllowed = this._sessionState !== newState;
     
    switch (this._sessionState) {
    case WebInspector.ReplayManager.SessionState.Capturing:
    isAllowed &= newState === WebInspector.ReplayManager.SessionState.Inactive;
    break;
     
    case WebInspector.ReplayManager.SessionState.Replaying:
    isAllowed &= newState === WebInspector.ReplayManager.SessionState.Inactive;
    break;
    }
     
    console.assert(isAllowed, "Invalid session state change: ", this._sessionState, " to ", newState);
    if (isAllowed)
    this._sessionState = newState;
    },
     
    _changeSegmentState: function(newState)
    {
    // Warn about no-op state changes. We shouldn't be seeing them.
    var isAllowed = this._segmentState !== newState;
     
    switch (this._segmentState) {
    case WebInspector.ReplayManager.SegmentState.Appending:
    isAllowed &= newState === WebInspector.ReplayManager.SegmentState.Unloaded;
    break;
    case WebInspector.ReplayManager.SegmentState.Unloaded:
    isAllowed &= newState === WebInspector.ReplayManager.SegmentState.Appending || newState === WebInspector.ReplayManager.SegmentState.Loaded;
    break;
    case WebInspector.ReplayManager.SegmentState.Loaded:
    isAllowed &= newState === WebInspector.ReplayManager.SegmentState.Unloaded || newState === WebInspector.ReplayManager.SegmentState.Dispatching;
    break;
    case WebInspector.ReplayManager.SegmentState.Dispatching:
    isAllowed &= newState === WebInspector.ReplayManager.SegmentState.Loaded;
    break;
    }
     
    console.assert(isAllowed, "Invalid segment state change: ", this._segmentState, " to ", newState);
    if (isAllowed)
    this._segmentState = newState;
    }
    };

  7. #7
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    /*
    * Copyright (C) 2011-2013 University of Washington. All rights reserved.
    * Copyright (C) 2014 Apple Inc. All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
     
    #include "config.h"
    #include "InspectorReplayAgent.h"
    #if ENABLE(INSPECTOR) && ENABLE(WEB_REPLAY)
     
    #include "DocumentLoader.h"
    #include "Event.h"
    #include "EventLoopInput.h"
    #include "Frame.h"
    #include "FunctorInputCursor.h"
    #include "InspectorController.h"
    #include "InspectorPageAgent.h"
    #include "InspectorWebTypeBuilders.h"
    #include "InstrumentingAgents.h"
    #include "Logging.h"
    #include "Page.h"
    #include "ReplayController.h"
    #include "ReplaySession.h"
    #include "ReplaySessionSegment.h"
    #include "SerializationMethods.h"
    #include "WebReplayInputs.h" // For EncodingTraits<InputQueue>.
    #include <inspector/InspectorValues.h>
    #include <wtf/text/CString.h>
    #include <wtf/text/WTFString.h>
     
    using namespace Inspector;
     
    namespace WebCore {
     
    static PassRefPtr<TypeBuilder::Replay::ReplayPosition> buildInspectorObjectForPosition(const ReplayPosition& position)
    {
    RefPtr<TypeBuilder::Replay::ReplayPosition> positionObject = TypeBuilder::Replay::ReplayPosition::create()
    .setSegmentOffset(position.segmentOffset)
    .setInputOffset(position.inputOffset);
     
    return positionObject.release();
    }
     
    static PassRefPtr<TypeBuilder::Replay::ReplayInput> buildInspectorObjectForInput(const NondeterministicInputBase& input, size_t offset)
    {
    EncodedValue encodedInput = EncodingTraits<NondeterministicInputBase>::encodeValue(input);
    RefPtr<TypeBuilder::Replay::ReplayInput> inputObject = TypeBuilder::Replay::ReplayInput::create()
    .setType(input.type())
    .setOffset(offset)
    .setData(encodedInput.asObject());
     
    if (input.queue() == InputQueue::EventLoopInput)
    inputObject->setTimestamp(static_cast<const EventLoopInputBase&>(input).timestamp());
     
    return inputObject.release();
    }
     
    static PassRefPtr<TypeBuilder::Replay::ReplaySession> buildInspectorObjectForSession(PassRefPtr<ReplaySession> prpSession)
    {
    RefPtr<ReplaySession> session = prpSession;
    RefPtr<TypeBuilder::Array<SegmentIdentifier>> segments = TypeBuilder::Array<SegmentIdentifier>::create();
     
    for (auto it = session->begin(); it != session->end(); ++it)
    segments->addItem((*it)->identifier());
     
    RefPtr<TypeBuilder::Replay::ReplaySession> sessionObject = TypeBuilder::Replay::ReplaySession::create()
    .setId(session->identifier())
    .setTimestamp(session->timestamp())
    .setSegments(segments.release());
     
    return sessionObject.release();
    }
     
    class SerializeInputToJSONFunctor {
    public:
    typedef PassRefPtr<TypeBuilder::Array<TypeBuilder::Replay::ReplayInput>> ReturnType;
     
    SerializeInputToJSONFunctor()
    : m_inputs(TypeBuilder::Array<TypeBuilder::Replay::ReplayInput>::create()) { }
    ~SerializeInputToJSONFunctor() { }
     
    void operator()(size_t index, const NondeterministicInputBase* input)
    {
    LOG(WebReplay, "%-25s Writing %5zu: %s\n", "[SerializeInput]", index, input->type().string().ascii().data());
     
    if (RefPtr<TypeBuilder::Replay::ReplayInput> serializedInput = buildInspectorObjectForInput(*input, index))
    m_inputs->addItem(serializedInput.release());
    }
     
    ReturnType returnValue() { return m_inputs.release(); }
    private:
    RefPtr<TypeBuilder::Array<TypeBuilder::Replay::ReplayInput>> m_inputs;
    };
     
    static PassRefPtr<TypeBuilder::Replay::SessionSegment> buildInspectorObjectForSegment(PassRefPtr<ReplaySessionSegment> prpSegment)
    {
    RefPtr<ReplaySessionSegment> segment = prpSegment;
    RefPtr<TypeBuilder::Array<TypeBuilder::Replay::ReplayInputQueue>> queuesObject = TypeBuilder::Array<TypeBuilder::Replay::ReplayInputQueue>::create();
     
    for (size_t i = 0; i < static_cast<size_t>(InputQueue::Count); i++) {
    SerializeInputToJSONFunctor collector;
    InputQueue queue = static_cast<InputQueue>(i);
    RefPtr<FunctorInputCursor> functorCursor = segment->createFunctorCursor();
    RefPtr<TypeBuilder::Array<TypeBuilder::Replay::ReplayInput>> queueInputs = functorCursor->forEachInputInQueue(queue, collector);
     
    RefPtr<TypeBuilder::Replay::ReplayInputQueue> queueObject = TypeBuilder::Replay::ReplayInputQueue::create()
    .setType(EncodingTraits<InputQueue>::encodeValue(queue).convertTo<String>())
    .setInputs(queueInputs);
     
    queuesObject->addItem(queueObject.release());
    }
     
    RefPtr<TypeBuilder::Replay::SessionSegment> segmentObject = TypeBuilder::Replay::SessionSegment::create()
    .setId(segment->identifier())
    .setTimestamp(segment->timestamp())
    .setQueues(queuesObject.release());
     
    return segmentObject.release();
    }
     
    InspectorReplayAgent::InspectorReplayAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
    : InspectorAgentBase(ASCIILiteral("Replay"), instrumentingAgents)
    , m_page(*pageAgent->page())
    {
    }
     
    InspectorReplayAgent::~InspectorReplayAgent()
    {
    ASSERT(!m_sessionsMap.size());
    ASSERT(!m_segmentsMap.size());
    }
     
    SessionState InspectorReplayAgent::sessionState() const
    {
    return m_page.replayController().sessionState();
    }
     
    void InspectorReplayAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
    {
    m_frontendDispatcher = std::make_unique<InspectorReplayFrontendDispatcher>(frontendChannel);
    m_backendDispatcher = InspectorReplayBackendDispatcher::create(backendDispatcher, this);
     
    m_instrumentingAgents->setInspectorReplayAgent(this);
    ASSERT(sessionState() == SessionState::Inactive);
     
    // Keep track of the (default) session currently loaded by ReplayController,
    // and any segments within the session.
    RefPtr<ReplaySession> session = m_page.replayController().loadedSession();
    m_sessionsMap.add(session->identifier(), session);
     
    for (auto it = session->begin(); it != session->end(); ++it)
    m_segmentsMap.add((*it)->identifier(), *it);
    }
     
    void InspectorReplayAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason)
    {
    m_frontendDispatcher = nullptr;
    m_backendDispatcher.clear();
     
    m_instrumentingAgents->setInspectorReplayAgent(nullptr);
     
    // Drop references to all sessions and segments.
    m_sessionsMap.clear();
    m_segmentsMap.clear();
    }
     
    void InspectorReplayAgent::frameNavigated(DocumentLoader* loader)
    {
    if (sessionState() != SessionState::Inactive)
    m_page.replayController().frameNavigated(loader);
    }
     
    void InspectorReplayAgent::frameDetached(Frame* frame)
    {
    if (sessionState() != SessionState::Inactive)
    m_page.replayController().frameDetached(frame);
    }
     
    void InspectorReplayAgent::willDispatchEvent(const Event& event, Frame* frame)
    {
    if (sessionState() != SessionState::Inactive)
    m_page.replayController().willDispatchEvent(event, frame);
    }
     
    void InspectorReplayAgent::sessionCreated(PassRefPtr<ReplaySession> prpSession)
    {
    RefPtr<ReplaySession> session = prpSession;
     
    auto result = m_sessionsMap.add(session->identifier(), session);
    // Can't have two sessions with same identifier.
    ASSERT_UNUSED(result, result.isNewEntry);
     
    m_frontendDispatcher->sessionCreated(session->identifier());
    }
     
    void InspectorReplayAgent::sessionModified(PassRefPtr<ReplaySession> session)
    {
    m_frontendDispatcher->sessionModified(session->identifier());
    }
     
    void InspectorReplayAgent::sessionLoaded(PassRefPtr<ReplaySession> prpSession)
    {
    RefPtr<ReplaySession> session = prpSession;
     
    // In case we didn't know about the loaded session, add here.
    m_sessionsMap.add(session->identifier(), session);
     
    m_frontendDispatcher->sessionLoaded(session->identifier());
    }
     
    void InspectorReplayAgent::segmentCreated(PassRefPtr<ReplaySessionSegment> prpSegment)
    {
    RefPtr<ReplaySessionSegment> segment = prpSegment;
     
    auto result = m_segmentsMap.add(segment->identifier(), segment);
    // Can't have two segments with the same identifier.
    ASSERT_UNUSED(result, result.isNewEntry);
     
    m_frontendDispatcher->segmentCreated(segment->identifier());
    }
     
    void InspectorReplayAgent::segmentCompleted(PassRefPtr<ReplaySessionSegment> segment)
    {
    m_frontendDispatcher->segmentCompleted(segment->identifier());
    }
     
    void InspectorReplayAgent::segmentLoaded(PassRefPtr<ReplaySessionSegment> prpSegment)
    {
    RefPtr<ReplaySessionSegment> segment = prpSegment;
     
    // In case we didn't know about the loaded segment, add here.
    m_segmentsMap.add(segment->identifier(), segment);
     
    m_frontendDispatcher->segmentLoaded(segment->identifier());
    }
     
    void InspectorReplayAgent::segmentUnloaded()
    {
    m_frontendDispatcher->segmentUnloaded();
    }
     
    void InspectorReplayAgent::captureStarted()
    {
    LOG(WebReplay, "-----CAPTURE START-----");
    m_frontendDispatcher->captureStarted();
    }
     
    void InspectorReplayAgent::captureStopped()
    {
    LOG(WebReplay, "-----CAPTURE STOP-----");
    m_frontendDispatcher->captureStopped();
    }
     
    void InspectorReplayAgent::playbackStarted()
    {
    LOG(WebReplay, "-----REPLAY START-----");
     
    m_frontendDispatcher->playbackStarted();
    }
     
    void InspectorReplayAgent::playbackPaused(const ReplayPosition& position)
    {
    LOG(WebReplay, "-----REPLAY PAUSED-----");
     
    m_frontendDispatcher->playbackPaused(buildInspectorObjectForPosition(position));
    }
     
    void InspectorReplayAgent::playbackHitPosition(const ReplayPosition& position)
    {
    m_frontendDispatcher->playbackHitPosition(buildInspectorObjectForPosition(position), monotonicallyIncreasingTime());
    }
     
    void InspectorReplayAgent::playbackFinished()
    {
    LOG(WebReplay, "-----REPLAY FINISHED-----");
     
    m_frontendDispatcher->playbackFinished();
    }
     
    void InspectorReplayAgent::startCapturing(ErrorString* errorString)
    {
    if (sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't start capturing if the session is already capturing or replaying.");
    return;
    }
     
    m_page.replayController().startCapturing();
    }
     
    void InspectorReplayAgent::stopCapturing(ErrorString* errorString)
    {
    if (sessionState() != SessionState::Capturing) {
    *errorString = ASCIILiteral("Can't stop capturing if capture is not in progress.");
    return;
    }
     
    m_page.replayController().stopCapturing();
    }
     
    void InspectorReplayAgent::replayToPosition(ErrorString* errorString, const RefPtr<InspectorObject>& positionObject, bool fastReplay)
    {
    ReplayPosition position;
    if (!positionObject->getNumber(ASCIILiteral("segmentOffset"), &position.segmentOffset)) {
    *errorString = ASCIILiteral("Couldn't decode ReplayPosition segment offset provided to ReplayAgent.replayToPosition.");
    return;
    }
     
    if (!positionObject->getNumber(ASCIILiteral("inputOffset"), &position.inputOffset)) {
    *errorString = ASCIILiteral("Couldn't decode ReplayPosition input offset provided to ReplayAgent.replayToPosition.");
    return;
    }
     
    if (sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't start replay while capture or playback is in progress.");
    return;
    }
     
    m_page.replayController().replayToPosition(position, (fastReplay) ? DispatchSpeed::FastForward : DispatchSpeed::RealTime);
    }
     
    void InspectorReplayAgent::replayToCompletion(ErrorString* errorString, bool fastReplay)
    {
    if (sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't start replay while capture or playback is in progress.");
    return;
    }
     
    m_page.replayController().replayToCompletion((fastReplay) ? DispatchSpeed::FastForward : DispatchSpeed::RealTime);
    }
     
    void InspectorReplayAgent::pausePlayback(ErrorString* errorString)
    {
    if (sessionState() != SessionState::Replaying) {
    *errorString = ASCIILiteral("Can't pause playback if playback is not in progress.");
    return;
    }
     
    m_page.replayController().pausePlayback();
    }
     
    void InspectorReplayAgent::cancelPlayback(ErrorString* errorString)
    {
    if (sessionState() == SessionState::Capturing) {
    *errorString = ASCIILiteral("Can't cancel playback if capture is in progress.");
    return;
    }
     
    m_page.replayController().cancelPlayback();
    }
     
    void InspectorReplayAgent::switchSession(ErrorString* errorString, SessionIdentifier identifier)
    {
    ASSERT(identifier > 0);
     
    if (sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't switch sessions unless the session is neither capturing or replaying.");
    return;
    }
     
    RefPtr<ReplaySession> session = findSession(errorString, identifier);
    if (!session)
    return;
     
    m_page.replayController().switchSession(session);
    }
     
    void InspectorReplayAgent::insertSessionSegment(ErrorString* errorString, SessionIdentifier sessionIdentifier, SegmentIdentifier segmentIdentifier, int segmentIndex)
    {
    ASSERT(sessionIdentifier > 0);
    ASSERT(segmentIdentifier > 0);
    ASSERT(segmentIndex >= 0);
     
    RefPtr<ReplaySession> session = findSession(errorString, sessionIdentifier);
    RefPtr<ReplaySessionSegment> segment = findSegment(errorString, segmentIdentifier);
     
    if (!session || !segment)
    return;
     
    if (static_cast<size_t>(segmentIndex) > session->size()) {
    *errorString = ASCIILiteral("Invalid segment index.");
    return;
    }
     
    if (session == m_page.replayController().loadedSession() && sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't modify a loaded session unless the session is inactive.");
    return;
    }
     
    session->insertSegment(segmentIndex, segment);
    sessionModified(session);
    }
     
    void InspectorReplayAgent::removeSessionSegment(ErrorString* errorString, SessionIdentifier identifier, int segmentIndex)
    {
    ASSERT(identifier > 0);
    ASSERT(segmentIndex >= 0);
     
    RefPtr<ReplaySession> session = findSession(errorString, identifier);
     
    if (!session)
    return;
     
    if (static_cast<size_t>(segmentIndex) >= session->size()) {
    *errorString = ASCIILiteral("Invalid segment index.");
    return;
    }
     
    if (session == m_page.replayController().loadedSession() && sessionState() != SessionState::Inactive) {
    *errorString = ASCIILiteral("Can't modify a loaded session unless the session is inactive.");
    return;
    }
     
    session->removeSegment(segmentIndex);
    sessionModified(session);
    }
     
    PassRefPtr<ReplaySession> InspectorReplayAgent::findSession(ErrorString* errorString, SessionIdentifier identifier)
    {
    ASSERT(identifier > 0);
     
    auto it = m_sessionsMap.find(identifier);
    if (it == m_sessionsMap.end()) {
    *errorString = ASCIILiteral("Couldn't find session with specified identifier");
    return nullptr;
    }
     
    return it->value;
    }
     
    PassRefPtr<ReplaySessionSegment> InspectorReplayAgent::findSegment(ErrorString* errorString, SegmentIdentifier identifier)
    {
    ASSERT(identifier > 0);
     
    auto it = m_segmentsMap.find(identifier);
    if (it == m_segmentsMap.end()) {
    *errorString = ASCIILiteral("Couldn't find segment with specified identifier");
    return nullptr;
    }
     
    return it->value;
    }
     
    void InspectorReplayAgent::getAvailableSessions(ErrorString*, RefPtr<Inspector::TypeBuilder::Array<SessionIdentifier>>& sessionsList)
    {
    sessionsList = TypeBuilder::Array<SessionIdentifier>::create();
    for (auto& pair : m_sessionsMap)
    sessionsList->addItem(pair.key);
    }
     
    void InspectorReplayAgent::getSerializedSession(ErrorString* errorString, SessionIdentifier identifier, RefPtr<Inspector::TypeBuilder::Replay::ReplaySession>& serializedObject)
    {
    RefPtr<ReplaySession> session = findSession(errorString, identifier);
    if (!session) {
    *errorString = ASCIILiteral("Couldn't find the specified session.");
    return;
    }
     
    serializedObject = buildInspectorObjectForSession(session);
    }
     
    void InspectorReplayAgent::getSerializedSegment(ErrorString* errorString, SegmentIdentifier identifier, RefPtr<Inspector::TypeBuilder::Replay::SessionSegment>& serializedObject)
    {
    RefPtr<ReplaySessionSegment> segment = findSegment(errorString, identifier);
    if (!segment) {
    *errorString = ASCIILiteral("Couldn't find the specified segment.");
    return;
    }
     
    serializedObject = buildInspectorObjectForSegment(segment);
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(INSPECTOR) && ENABLE(WEB_REPLAY)

  8. #8
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    /*
    * Copyright (C) 2011-2013 University of Washington. All rights reserved.
    * Copyright (C) 2014 Apple Inc. All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
     
    #include "config.h"
    #include "ReplayController.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "AllReplayInputs.h"
    #include "CapturingInputCursor.h"
    #include "DOMWindow.h"
    #include "DocumentLoader.h"
    #include "Frame.h"
    #include "FrameTree.h"
    #include "InspectorInstrumentation.h"
    #include "Location.h"
    #include "Logging.h"
    #include "MainFrame.h"
    #include "Page.h"
    #include "ReplaySession.h"
    #include "ReplaySessionSegment.h"
    #include "ReplayingInputCursor.h"
    #include "ScriptController.h"
    #include "SerializationMethods.h"
    #include "Settings.h"
    #include "UserInputBridge.h"
    #include "WebReplayInputs.h"
    #include <replay/EmptyInputCursor.h>
    #include <wtf/text/CString.h>
     
    #if ENABLE(ASYNC_SCROLLING)
    #include "ScrollingCoordinator.h"
    #endif
     
    namespace WebCore {
     
    static void logDispatchedDOMEvent(const Event& event, bool eventIsUnrelated)
    {
    #if !LOG_DISABLED
    EventTarget* target = event.target();
    if (!target)
    return;
     
    // A DOM event is unrelated if it is being dispatched to a document that is neither capturing nor replaying.
    if (Node* node = target->toNode()) {
    LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%lu/node[%p] %s\n", "ReplayEvents",
    (eventIsUnrelated) ? "Unrelated" : "Dispatching",
    event.type().string().utf8().data(),
    frameIndexFromDocument((node->inDocument()) ? &node->document() : node->ownerDocument()),
    node,
    node->nodeName().utf8().data());
    } else if (DOMWindow* window = target->toDOMWindow()) {
    LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%lu/window[%p] %s\n", "ReplayEvents",
    (eventIsUnrelated) ? "Unrelated" : "Dispatching",
    event.type().string().utf8().data(),
    frameIndexFromDocument(window->document()),
    window,
    window->location()->href().utf8().data());
    }
    #else
    UNUSED_PARAM(event);
    UNUSED_PARAM(eventIsUnrelated);
    #endif
    }
     
    ReplayController::ReplayController(Page& page)
    : m_page(page)
    , m_loadedSegment(nullptr)
    , m_loadedSession(ReplaySession::create())
    , m_emptyCursor(EmptyInputCursor::create())
    , m_activeCursor(nullptr)
    , m_targetPosition(ReplayPosition(0, 0))
    , m_currentPosition(ReplayPosition(0, 0))
    , m_segmentState(SegmentState::Unloaded)
    , m_sessionState(SessionState::Inactive)
    , m_dispatchSpeed(DispatchSpeed::FastForward)
    {
    }
     
    void ReplayController::setForceDeterministicSettings(bool shouldForceDeterministicBehavior)
    {
    ASSERT(shouldForceDeterministicBehavior ^ (m_sessionState == SessionState::Inactive));
     
    if (shouldForceDeterministicBehavior) {
    m_savedSettings.usesPageCache = m_page.settings().usesPageCache();
     
    m_page.settings().setUsesPageCache(false);
    } else {
    m_page.settings().setUsesPageCache(m_savedSettings.usesPageCache);
    }
     
    if (ScrollingCoordinator* scrollingCoordinator = m_page.scrollingCoordinator())
    scrollingCoordinator->replaySessionStateDidChange();
    }
     
    void ReplayController::setSessionState(SessionState state)
    {
    ASSERT(state != m_sessionState);
     
    switch (m_sessionState) {
    case SessionState::Capturing:
    ASSERT(state == SessionState::Inactive);
     
    m_sessionState = state;
    m_page.userInputBridge().setState(UserInputBridge::State::Open);
    break;
     
    case SessionState::Inactive:
    m_sessionState = state;
    m_page.userInputBridge().setState(state == SessionState::Capturing ? UserInputBridge::State::Capturing : UserInputBridge::State::Replaying);
    break;
     
    case SessionState::Replaying:
    ASSERT(state == SessionState::Inactive);
     
    m_sessionState = state;
    m_page.userInputBridge().setState(UserInputBridge::State::Open);
    break;
    }
    }
     
    void ReplayController::switchSession(PassRefPtr<ReplaySession> session)
    {
    ASSERT(m_segmentState == SegmentState::Unloaded);
    ASSERT(m_sessionState == SessionState::Inactive);
     
    m_loadedSession = session;
    m_currentPosition = ReplayPosition(0, 0);
     
    LOG(WebReplay, "%-20sSwitching sessions from %p to %p.\n", "ReplayController", m_loadedSession.get(), session.get());
    InspectorInstrumentation::sessionLoaded(&m_page, m_loadedSession);
    }
     
    void ReplayController::createSegment()
    {
    ASSERT(m_sessionState == SessionState::Capturing);
    ASSERT(m_segmentState == SegmentState::Unloaded);
     
    m_segmentState = SegmentState::Appending;
     
    // Create a new segment but don't associate it with the current session
    // until we stop appending to it. This preserves the invariant that
    // segments associated with a replay session have immutable data.
    m_loadedSegment = ReplaySessionSegment::create();
     
    LOG(WebReplay, "%-20s Created segment: %p.\n", "ReplayController", m_loadedSegment.get());
    InspectorInstrumentation::segmentCreated(&m_page, m_loadedSegment);
     
    m_activeCursor = m_loadedSegment->createCapturingCursor(m_page);
    m_activeCursor->appendInput<BeginSegmentSentinel>();
     
    std::unique_ptr<InitialNavigation> navigationInput = InitialNavigation::createFromPage(m_page);
    // Dispatching this input schedules navigation of the main frame, causing a refresh.
    navigationInput->dispatch(*this);
    m_activeCursor->storeInput(std::move(navigationInput));
    }
     
    void ReplayController::completeSegment()
    {
    ASSERT(m_sessionState == SessionState::Capturing);
    ASSERT(m_segmentState == SegmentState::Appending);
     
    m_activeCursor->appendInput<EndSegmentSentinel>();
     
    // Hold on to a reference so unloading the segment doesn't deallocate it.
    RefPtr<ReplaySessionSegment> segment = m_loadedSegment;
    m_segmentState = SegmentState::Loaded;
    bool shouldSuppressNotifications = true;
    unloadSegment(shouldSuppressNotifications);
     
    LOG(WebReplay, "%-20s Completed segment: %p.\n", "ReplayController", segment.get());
    InspectorInstrumentation::segmentCompleted(&m_page, segment);
     
    m_loadedSession->appendSegment(segment);
    InspectorInstrumentation::sessionModified(&m_page, m_loadedSession);
    }
     
    void ReplayController::loadSegmentAtIndex(size_t segmentIndex)
    {
    ASSERT(segmentIndex < m_loadedSession->size());
    RefPtr<ReplaySessionSegment> segment = m_loadedSession->at(segmentIndex);
     
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState::Unloaded);
    ASSERT(segment);
    ASSERT(!m_loadedSegment);
     
    m_loadedSegment = segment;
    m_segmentState = SegmentState::Loaded;
     
    m_currentPosition.segmentOffset = segmentIndex;
    m_currentPosition.inputOffset = 0;
     
    m_activeCursor = m_loadedSegment->createReplayingCursor(m_page, this);
     
    LOG(WebReplay, "%-20sLoading segment: %p.\n", "ReplayController", segment.get());
    InspectorInstrumentation::segmentLoaded(&m_page, segment);
    }
     
    void ReplayController::unloadSegment(bool suppressNotifications)
    {
    ASSERT(m_sessionState != SessionState::Inactive);
    ASSERT(m_segmentState == SegmentState::Loaded);
     
    m_segmentState = SegmentState::Unloaded;
     
    LOG(WebReplay, "%-20s Clearing input cursors for page: %p\n", "ReplayController", &m_page);
     
    m_activeCursor = nullptr;
    RefPtr<ReplaySessionSegment> unloadedSegment = m_loadedSegment.release();
    for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
    frame->script().globalObject(mainThreadNormalWorld())->setInputCursor(m_emptyCursor);
    frame->document()->setInputCursor(m_emptyCursor);
    }
     
    // When we stop capturing, don't send out segment unloaded events since we
    // didn't send out the corresponding segmentLoaded event at the start of capture.
    if (!suppressNotifications) {
    LOG(WebReplay, "%-20sUnloading segment: %p.\n", "ReplayController", unloadedSegment.get());
    InspectorInstrumentation::segmentUnloaded(&m_page);
    }
    }
     
    void ReplayController::startCapturing()
    {
    ASSERT(m_sessionState == SessionState::Inactive);
    ASSERT(m_segmentState == SegmentState::Unloaded);
     
    setSessionState(SessionState::Capturing);
    setForceDeterministicSettings(true);
     
    LOG(WebReplay, "%-20s Starting capture.\n", "ReplayController");
    InspectorInstrumentation::captureStarted(&m_page);
     
    m_currentPosition = ReplayPosition(0, 0);
     
    createSegment();
    }
     
    void ReplayController::stopCapturing()
    {
    ASSERT(m_sessionState == SessionState::Capturing);
    ASSERT(m_segmentState == SegmentState::Appending);
     
    completeSegment();
     
    setSessionState(SessionState::Inactive);
    setForceDeterministicSettings(false);
     
    LOG(WebReplay, "%-20s Stopping capture.\n", "ReplayController");
    InspectorInstrumentation::captureStopped(&m_page);
    }
     
    void ReplayController::startPlayback()
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState::Loaded);
     
    m_segmentState = SegmentState:ispatching;
     
    LOG(WebReplay, "%-20s Starting playback to position (segment: %d, input: %d).\n", "ReplayController", m_targetPosition.segmentOffset, m_targetPosition.inputOffset);
    InspectorInstrumentation::playbackStarted(&m_page);
     
    dispatcher().setDispatchSpeed(m_dispatchSpeed);
    dispatcher().run();
    }
     
    void ReplayController::pausePlayback()
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState:ispatching);
     
    if (dispatcher().isRunning())
    dispatcher().pause();
     
    m_segmentState = SegmentState::Loaded;
     
    LOG(WebReplay, "%-20s Pausing playback at position (segment: %d, input: %d).\n", "ReplayController", m_currentPosition.segmentOffset, m_currentPosition.inputOffset);
    InspectorInstrumentation::playbackPaused(&m_page, m_currentPosition);
    }
     
    void ReplayController::cancelPlayback()
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState != SegmentState::Appending);
     
    if (m_segmentState == SegmentState::Unloaded)
    return;
     
    if (m_segmentState == SegmentState:ispatching)
    pausePlayback();
     
    ASSERT(m_segmentState == SegmentState::Loaded);
    unloadSegment();
    m_sessionState = SessionState::Inactive;
    setForceDeterministicSettings(false);
    InspectorInstrumentation::playbackFinished(&m_page);
    }
     
    void ReplayController::replayToPosition(const ReplayPosition& position, DispatchSpeed speed)
    {
    ASSERT(m_sessionState != SessionState::Capturing);
    ASSERT(m_segmentState == SegmentState::Loaded || m_segmentState == SegmentState::Unloaded);
    ASSERT(position.segmentOffset < m_loadedSession->size());
     
    m_dispatchSpeed = speed;
     
    if (m_sessionState != SessionState::Replaying) {
    setSessionState(SessionState::Replaying);
    setForceDeterministicSettings(true);
    }
     
    if (m_segmentState == SegmentState::Unloaded)
    loadSegmentAtIndex(position.segmentOffset);
    else if (position.segmentOffset != m_currentPosition.segmentOffset || m_currentPosition.inputOffset > position.inputOffset) {
    // If the desired segment is not loaded or we have gone past the desired input
    // offset, then unload the current segment and load the appropriate segment.
    unloadSegment();
    loadSegmentAtIndex(position.segmentOffset);
    }
     
    ASSERT(m_currentPosition.segmentOffset == position.segmentOffset);
    ASSERT(m_loadedSession->at(position.segmentOffset) == m_loadedSegment);
     
    m_targetPosition = position;
    startPlayback();
    }
     
    void ReplayController::frameNavigated(DocumentLoader* loader)
    {
    ASSERT(m_sessionState != SessionState::Inactive);
     
    // The initial capturing segment is created prior to main frame navigation.
    // Otherwise, the prior capturing segment was completed when the frame detached,
    // and it is now time to create a new segment.
    if (m_sessionState == SessionState::Capturing && m_segmentState == SegmentState::Unloaded) {
    m_currentPosition = ReplayPosition(m_currentPosition.segmentOffset + 1, 0);
    createSegment();
    }
     
    // During playback, the next segment is loaded when the final input is dispatched,
    // so nothing needs to be done here.
     
    // We store the input cursor in both Document and JSDOMWindow, so that
    // replay state is accessible from JavaScriptCore and script-free layout code.
    loader->frame()->document()->setInputCursor(m_activeCursor.get());
    loader->frame()->script().globalObject(mainThreadNormalWorld())->setInputCursor(m_activeCursor.get());
    }
     
    void ReplayController::frameDetached(Frame* frame)
    {
    ASSERT(m_sessionState != SessionState::Inactive);
    ASSERT(frame);
     
    if (!frame->document())
    return;
     
    // If the frame's cursor isn't capturing or replaying, we should do nothing.
    // This is the case for the "outbound" frame when starting capture, or when
    // we clear the input cursor to finish or prematurely unload a segment.
    if (frame->document()->inputCursor().isCapturing()) {
    ASSERT(m_segmentState == SegmentState::Appending);
    completeSegment();
    }
     
    // During playback, the segments are unloaded and loaded when the final
    // input has been dispatched. So, nothing needs to be done here.
    }
     
    void ReplayController::willDispatchEvent(const Event& event, Frame* frame)
    {
    EventTarget* target = event.target();
    if (!target && !frame)
    return;
     
    Document* document = frame ? frame->document() : nullptr;
    // Fetch the document from the event target, because the target could be detached.
    if (Node* node = target->toNode())
    document = node->inDocument() ? &node->document() : node->ownerDocument();
    else if (DOMWindow* window = target->toDOMWindow())
    document = window->document();
     
    ASSERT(document);
     
    InputCursor& cursor = document->inputCursor();
    bool eventIsUnrelated = !cursor.isCapturing() && !cursor.isReplaying();
    logDispatchedDOMEvent(event, eventIsUnrelated);
     
    #if ENABLE_AGGRESSIVE_DETERMINISM_CHECKS
    // To ensure deterministic JS execution, all DOM events must be dispatched deterministically.
    // If these assertions fail, then this DOM event is being dispatched by a nondeterministic EventLoop
    // cycle, and may cause program execution to diverge if any JS code runs because of the DOM event.
    if (cursor.isCapturing())
    ASSERT(static_cast<CapturingInputCursor&>(cursor).withinEventLoopInputExtent());
    else if (cursor.isReplaying())
    ASSERT(dispatcher().isDispatching());
    #endif
    }
     
    PassRefPtr<ReplaySession> ReplayController::loadedSession() const
    {
    return m_loadedSession;
    }
     
    PassRefPtr<ReplaySessionSegment> ReplayController::loadedSegment() const
    {
    return m_loadedSegment;
    }
     
    InputCursor& ReplayController::activeInputCursor() const
    {
    return m_activeCursor ? *m_activeCursor : *m_emptyCursor;
    }
     
    EventLoopInputDispatcher& ReplayController::dispatcher() const
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState:ispatching);
    ASSERT(m_activeCursor);
    ASSERT(m_activeCursor->isReplaying());
     
    return static_cast<ReplayingInputCursor&>(*m_activeCursor).dispatcher();
    }
     
    void ReplayController::willDispatchInput(const EventLoopInputBase&)
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState:ispatching);
     
    m_currentPosition.inputOffset++;
    if (m_currentPosition == m_targetPosition)
    pausePlayback();
    }
     
    void ReplayController::didDispatchInput(const EventLoopInputBase&)
    {
    ASSERT(m_sessionState == SessionState::Replaying);
    ASSERT(m_segmentState == SegmentState:ispatching);
     
    InspectorInstrumentation::playbackHitPosition(&m_page, m_currentPosition);
    }
     
    void ReplayController::didDispatchFinalInput()
    {
    ASSERT(m_segmentState == SegmentState:ispatching);
     
    // No more segments left to replay; stop.
    if (m_currentPosition.segmentOffset + 1 == m_loadedSession->size()) {
    // Normally the position is adjusted when loading the next segment.
    m_currentPosition.segmentOffset++;
    m_currentPosition.inputOffset = 0;
     
    cancelPlayback();
    return;
    }
     
    unloadSegment();
    loadSegmentAtIndex(m_currentPosition.segmentOffset + 1);
    startPlayback();
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  9. #9
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    using namespace Inspector;
     
    namespace WebCore {
     
    static const char* const requestAnimationFrameEventName = "requestAnimationFrame";
    static const char* const cancelAnimationFrameEventName = "cancelAnimationFrame";
    static const char* const animationFrameFiredEventName = "animationFrameFired";
    static const char* const setTimerEventName = "setTimer";
    static const char* const clearTimerEventName = "clearTimer";
    static const char* const timerFiredEventName = "timerFired";
     
    namespace {
    static HashSet<InstrumentingAgents*>* instrumentingAgentsSet = nullptr;
    }
     
    int InspectorInstrumentation::s_frontendCounter = 0;
     
    static Frame* frameForScriptExecutionContext(ScriptExecutionContext* context)
    {
    Frame* frame = nullptr;
    if (context->isDocument())
    frame = toDocument(context)->frame();
    return frame;
    }
     
    void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, DOMWrapperWorld& world)
    {
    InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent();
    if (pageAgent)
    pageAgent->didClearWindowObjectInWorld(frame, world);
    if (PageDebuggerAgent* debuggerAgent = instrumentingAgents->pageDebuggerAgent()) {
    if (pageAgent && &world == &mainThreadNormalWorld() && frame == pageAgent->mainFrame())
    debuggerAgent->didClearMainFrameWindowObject();
    }
    if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents->pageRuntimeAgent()) {
    if (&world == &mainThreadNormalWorld())
    pageRuntimeAgent->didCreateMainWorldContext(frame);
    }
    }
     
    bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
    return debuggerAgent->isPaused();
    return false;
    }
     
    void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* parent)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->willInsertDOMNode(parent);
    }
     
    void InspectorInstrumentation::didInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didInsertDOMNode(node);
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->didInsertDOMNode(node);
    }
     
    void InspectorInstrumentation::willRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->willRemoveDOMNode(node);
    }
     
    void InspectorInstrumentation::didRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->didRemoveDOMNode(node);
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didRemoveDOMNode(node);
    }
     
    void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->willModifyDOMAttr(element);
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->willModifyDOMAttr(element, oldValue, newValue);
    }
     
    void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name, const AtomicString& value)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didModifyDOMAttr(element, name, value);
    }
     
    void InspectorInstrumentation::didRemoveDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didRemoveDOMAttr(element, name);
    }
     
    void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents* instrumentingAgents, Node* node)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didInvalidateStyleAttr(node);
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->didInvalidateStyleAttr(node);
    }
     
    void InspectorInstrumentation::frameWindowDiscardedImpl(InstrumentingAgents* instrumentingAgents, DOMWindow* window)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->frameWindowDiscarded(window);
    }
     
    void InspectorInstrumentation::mediaQueryResultChangedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->mediaQueryResultChanged();
    }
     
    void InspectorInstrumentation::didPushShadowRootImpl(InstrumentingAgents* instrumentingAgents, Element* host, ShadowRoot* root)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didPushShadowRoot(host, root);
    }
     
    void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents* instrumentingAgents, Element* host, ShadowRoot* root)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->willPopShadowRoot(host, root);
    }
     
    void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->didCreateNamedFlow(document, namedFlow);
    }
     
    void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->willRemoveNamedFlow(document, namedFlow);
    }
     
    void InspectorInstrumentation::didChangeRegionOversetImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->didChangeRegionOverset(document, namedFlow);
    }
     
    void InspectorInstrumentation::didRegisterNamedFlowContentElementImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->didRegisterNamedFlowContentElement(document, namedFlow, contentElement, nextContentElement);
    }
     
    void InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow, Node* contentElement)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->didUnregisterNamedFlowContentElement(document, namedFlow, contentElement);
    }
     
    void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->mouseDidMoveOverElement(result, modifierFlags);
    }
     
    void InspectorInstrumentation::didScrollImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->didScroll();
    }
     
    bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents* instrumentingAgents, Node* node)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    return domAgent->handleTouchEvent(node);
    return false;
    }
     
    bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    return domAgent->handleMousePress();
    return false;
    }
     
    bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents* instrumentingAgents, Element* element, CSSSelector:seudoClassType pseudoState)
    {
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    return cssAgent->forcePseudoState(element, pseudoState);
    return false;
    }
     
    void InspectorInstrumentation::characterDataModifiedImpl(InstrumentingAgents* instrumentingAgents, CharacterData* characterData)
    {
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->characterDataModified(characterData);
    }
     
    void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->willSendXMLHttpRequest(url);
    }
     
    void InspectorInstrumentation::didScheduleResourceRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didScheduleResourceRequest(url, frame);
    }
     
    void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot, ScriptExecutionContext* context)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, setTimerEventName, true);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didInstallTimer(timerId, timeout, singleShot, frameForScriptExecutionContext(context));
    }
     
    void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, ScriptExecutionContext* context)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, clearTimerEventName, true);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context));
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willCallFunction(scriptName, scriptLine, frameForScriptExecutionContext(context));
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didCallFunction(frameForScriptExecutionContext(context));
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request, ScriptExecutionContext* context)
    {
    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    if (timelineAgent && request->hasEventListeners(eventNames().readystatechangeEvent)) {
    timelineAgent->willDispatchXHRReadyStateChangeEvent(request->url().string(), request->readyState(), frameForScriptExecutionContext(context));
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didDispatchXHRReadyStateChangeEvent();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents* instrumentingAgents, const Event& event, bool hasEventListeners, Document* document)
    {
    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    if (timelineAgent && hasEventListeners) {
    timelineAgent->willDispatchEvent(event, document->frame());
    timelineAgentId = timelineAgent->id();
    }
    #if ENABLE(WEB_REPLAY)
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->willDispatchEvent(event, document->frame());
    #endif
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, true, event->type(), false);
    return InspectorInstrumentationCookie(instrumentingAgents, 0);
    }
     
    void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
    {
    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
    }
     
    void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didDispatchEvent();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window)
    {
    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    if (timelineAgent && window->hasEventListeners(event.type())) {
    timelineAgent->willDispatchEvent(event, window ? window->frame() : nullptr);
    timelineAgentId = timelineAgent->id();
    }
    #if ENABLE(WEB_REPLAY)
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->willDispatchEvent(event, window ? window->frame() : nullptr);
    #endif
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didDispatchEvent();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents* instrumentingAgents, const String& url, int lineNumber, Frame* frame)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willEvaluateScript(url, lineNumber, frame);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didEvaluateScript(frame);
    }
     
    void InspectorInstrumentation::scriptsEnabledImpl(InstrumentingAgents* instrumentingAgents, bool isEnabled)
    {
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->scriptsEnabled(isEnabled);
    }
     
    void InspectorInstrumentation::didCreateIsolatedContextImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin)
    {
    if (PageRuntimeAgent* runtimeAgent = instrumentingAgents->pageRuntimeAgent())
    runtimeAgent->didCreateIsolatedContext(frame, scriptState, origin);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, ScriptExecutionContext* context)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, timerFiredEventName, false);
     
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willFireTimer(timerId, frameForScriptExecutionContext(context));
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
    {
    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
     
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didFireTimer();
    }
     
    void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didInvalidateLayout(frame);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willLayout(frame);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie, RenderObject* root)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didLayout(root);
     
    if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
    pageAgent->didLayout();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEventImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request, ScriptExecutionContext* context)
    {
    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    if (timelineAgent && request->hasEventListeners(eventNames().loadEvent)) {
    timelineAgent->willDispatchXHRLoadEvent(request->url(), frameForScriptExecutionContext(context));
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didDispatchXHRLoadEvent();
    }
     
    void InspectorInstrumentation::willPaintImpl(InstrumentingAgents* instrumentingAgents, RenderObject* renderer)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->willPaint(&renderer->frame());
    }
     
    void InspectorInstrumentation::didPaintImpl(InstrumentingAgents* instrumentingAgents, RenderObject* renderer, GraphicsContext* context, const LayoutRect& rect)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didPaint(renderer, rect);
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->didPaint(context, rect);
    }
     
    void InspectorInstrumentation::willScrollLayerImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->willScroll(frame);
    }
     
    void InspectorInstrumentation::didScrollLayerImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didScroll();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willRecalculateStyle(frame);
    timelineAgentId = timelineAgent->id();
    }
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->willRecalculateStyle();
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didRecalculateStyle();
    InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didRecalculateStyle();
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->didRecalculateStyle();
    }
     
    void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didScheduleStyleRecalculation(document->frame());
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didScheduleStyleRecalculation(document);
    }
     
    void InspectorInstrumentation::applyEmulatedMediaImpl(InstrumentingAgents* instrumentingAgents, String* media)
    {
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->applyEmulatedMedia(media);
    }
     
    void InspectorInstrumentation::willSendRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->willSendResourceRequest(identifier, request, loader->frame());
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
    }
     
    void InspectorInstrumentation::continueAfterPingLoaderImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
    {
    willSendRequestImpl(instrumentingAgents, identifier, loader, request, response);
    }
     
    void InspectorInstrumentation::markResourceAsCachedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->markResourceAsCached(identifier);
    }
     
    void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
    {
    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
    return;
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Frame* frame, int length)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willReceiveResourceData(identifier, frame, length);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didReceiveResourceDataImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didReceiveResourceData();
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Frame* frame)
    {
    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    if (timelineAgent) {
    timelineAgent->willReceiveResourceResponse(identifier, response, frame);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didReceiveResourceResponse();
    if (!loader)
    return;
    InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveResponse(identifier, loader, response, resourceLoader);
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
    }
     
    void InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
    {
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(frame, identifier, r);
    InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r, nullptr);
    }
     
    void InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
    {
    didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
    }
     
    void InspectorInstrumentation::continueWithPolicyDownloadImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
    {
    didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
    }
     
    void InspectorInstrumentation::continueWithPolicyIgnoreImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
    {
    didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
    }
     
    void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
    }
     
    void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didFinishLoadingResource(identifier, false, finishTime, loader->frame());
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didFinishLoading(identifier, loader, finishTime);
    }
     
    void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didFinishLoadingResource(identifier, true, 0, loader->frame());
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didFailLoading(identifier, loader, error);
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
    }
     
    void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, ThreadableLoaderClient* client)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->documentThreadableLoaderStartedLoadingForClient(identifier, client);
    }
     
    void InspectorInstrumentation::willLoadXHRImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->willLoadXHR(client, method, url, async, formData, headers, includeCredentials);
    }
     
    void InspectorInstrumentation::didFailXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didFailXHRLoading(client);
    }
     
    void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber, sendColumnNumber);
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didFinishXHRLoading(client, identifier, sourceString);
    }
     
    void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveXHRResponse(identifier);
    }
     
    void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->willLoadXHRSynchronously();
    }
     
    void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didLoadXHRSynchronously();
    }
     
    void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->setInitialScriptContent(identifier, sourceString);
    }
     
    void InspectorInstrumentation::scriptExecutionBlockedByCSPImpl(InstrumentingAgents* instrumentingAgents, const String& directiveText)
    {
    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
    debuggerAgent->scriptExecutionBlockedByCSP(directiveText);
    }
     
    void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveScriptResponse(identifier);
    }
     
    void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didMarkDOMContentEvent(frame);
     
    if (&frame->page()->mainFrame() != frame)
    return;
     
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->mainFrameDOMContentLoaded();
     
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->domContentEventFired();
    }
     
    void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didMarkLoadEvent(frame);
     
    if (&frame->page()->mainFrame() != frame)
    return;
     
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->loadEventFired();
    }
     
    void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->frameDetached(frame);
     
    #if ENABLE(WEB_REPLAY)
    if (frame->isMainFrame()) {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->frameDetached(frame);
    }
    #endif
    }
     
    void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrumentingAgents, Page* page, DocumentLoader* loader)
    {
    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
    return;
     
    if (loader->frame()->isMainFrame()) {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->reset();
     
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->mainFrameNavigated(loader);
     
    if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
    profilerAgent->reset();
     
    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    cssAgent->reset();
     
    #if ENABLE(SQL_DATABASE)
    if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
    databaseAgent->clearResources();
    #endif
     
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->setDocument(page->mainFrame().document());
     
    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
    layerTreeAgent->reset();
    }
     
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->didCommitLoad(loader->frame()->document());
     
    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    pageAgent->frameNavigated(loader);
     
    #if ENABLE(WEB_REPLAY)
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->frameNavigated(loader);
    #endif
    }
     
    void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
    return;
    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    domAgent->frameDocumentUpdated(frame);
    }
     
    void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
    inspectorPageAgent->loaderDetachedFromFrame(loader);
    }
     
    void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
    inspectorPageAgent->frameStartedLoading(frame);
    }
     
    void InspectorInstrumentation::frameStoppedLoadingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
    inspectorPageAgent->frameStoppedLoading(frame);
    }
     
    void InspectorInstrumentation::frameScheduledNavigationImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, double delay)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
    inspectorPageAgent->frameScheduledNavigation(frame, delay);
    }
     
    void InspectorInstrumentation::frameClearedScheduledNavigationImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
    inspectorPageAgent->frameClearedScheduledNavigation(frame);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialogImpl(InstrumentingAgents* instrumentingAgents, const String& message)
    {
    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
    inspectorPageAgent->willRunJavaScriptDialog(message);
    return InspectorInstrumentationCookie(instrumentingAgents, 0);
    }
     
    void InspectorInstrumentation::didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorPageAgent* inspectorPageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
    inspectorPageAgent->didRunJavaScriptDialog();
    }
     
    void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource* cachedResource)
    {
    if (!instrumentingAgentsSet)
    return;
    HashSet<InstrumentingAgents*>::iterator end = instrumentingAgentsSet->end();
    for (HashSet<InstrumentingAgents*>::iterator it = instrumentingAgentsSet->begin(); it != end; ++it) {
    InstrumentingAgents* instrumentingAgents = *it;
    if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgents->inspectorResourceAgent())
    inspectorResourceAgent->willDestroyCachedResource(cachedResource);
    }
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned startLine, Frame* frame)
    {
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willWriteHTML(startLine, frame);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCookie& cookie, unsigned endLine)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didWriteHTML(endLine);
    }
     
    // JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
    static bool isConsoleAssertMessage(MessageSource source, MessageType type)
    {
    return source == MessageSource::ConsoleAPI && type == MessageType::Assert;
    }
     
    // FIXME: Drop this once we no longer generate stacks outside of Inspector.
    void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->addMessageToConsole(source, type, level, message, callStack, requestIdentifier);
    // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
    if (isConsoleAssertMessage(source, type))
    debuggerAgent->handleConsoleAssert();
    }
    }
     
    void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->addMessageToConsole(source, type, level, message, state, arguments, requestIdentifier);
    // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
    if (isConsoleAssertMessage(source, type))
    debuggerAgent->handleConsoleAssert();
    }
    }
     
    void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->addMessageToConsole(source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
    }
     
    void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->count(state, arguments);
    }
     
    void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, const String& title)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->time(frame, title);
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->startTiming(title);
    }
     
    void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, const String& title, PassRefPtr<ScriptCallStack> stack)
    {
    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
    consoleAgent->stopTiming(title, stack);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->timeEnd(frame, title);
    }
     
    void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, PassRefPtr<ScriptArguments> arguments)
    {
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    String message;
    arguments->getFirstArgumentAsString(message);
    timelineAgent->didTimeStamp(frame, message);
    }
    }
     
    void InspectorInstrumentation::startProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title)
    {
    if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
    profilerAgent->startProfiling(title, exec);
    }
     
    PassRefPtr<JSC:rofile> InspectorInstrumentation::stopProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title)
    {
    if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
    return profilerAgent->stopProfiling(title, exec);
    return nullptr;
    }
     
    #if ENABLE(SQL_DATABASE)
    void InspectorInstrumentation::didOpenDatabaseImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
    {
    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
    return;
    if (InspectorDatabaseAgent* dbAgent = instrumentingAgents->inspectorDatabaseAgent())
    dbAgent->didOpenDatabase(database, domain, name, version);
    }
    #endif
     
    void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents* instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
    {
    if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
    domStorageAgent->didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
    }
     
    bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
    return workerAgent->shouldPauseDedicatedWorkerOnStart();
    return false;
    }
     
    void InspectorInstrumentation::didStartWorkerGlobalScopeImpl(InstrumentingAgents* instrumentingAgents, WorkerGlobalScopeProxy* workerGlobalScopeProxy, const URL& url)
    {
    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
    workerAgent->didStartWorkerGlobalScope(workerGlobalScopeProxy, url);
    }
     
    void InspectorInstrumentation::willEvaluateWorkerScript(WorkerGlobalScope* workerGlobalScope, int workerThreadStartMode)
    {
    if (workerThreadStartMode != PauseWorkerGlobalScopeOnStart)
    return;
    InstrumentingAgents* instrumentingAgents = instrumentationForWorkerGlobalScope(workerGlobalScope);
    if (!instrumentingAgents)
    return;
    if (WorkerRuntimeAgent* runtimeAgent = instrumentingAgents->workerRuntimeAgent())
    runtimeAgent->pauseWorkerGlobalScope(workerGlobalScope);
    }
     
    void InspectorInstrumentation::workerGlobalScopeTerminatedImpl(InstrumentingAgents* instrumentingAgents, WorkerGlobalScopeProxy* proxy)
    {
    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
    workerAgent->workerGlobalScopeTerminated(proxy);
    }
     
    #if ENABLE(WEB_SOCKETS)
    void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const URL& requestURL, const URL&, const String& protocol, Document* document)
    {
    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
    return;
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didCreateWebSocket(identifier, requestURL);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didCreateWebSocket(identifier, requestURL, protocol, document->frame());
    }
     
    void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceRequest& request, Document* document)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->willSendWebSocketHandshakeRequest(identifier, document->frame());
    }
     
    void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Document* document)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didReceiveWebSocketHandshakeResponse(identifier, document->frame());
    }
     
    void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Document* document)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didCloseWebSocket(identifier);
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didDestroyWebSocket(identifier, document->frame());
    }
     
    void InspectorInstrumentation::didReceiveWebSocketFrameImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveWebSocketFrame(identifier, frame);
    }
    void InspectorInstrumentation::didReceiveWebSocketFrameErrorImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& errorMessage)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didReceiveWebSocketFrameError(identifier, errorMessage);
    }
    void InspectorInstrumentation::didSendWebSocketFrameImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
    {
    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    resourceAgent->didSendWebSocketFrame(identifier, frame);
    }
    #endif
     
    #if ENABLE(WEB_REPLAY)
    void InspectorInstrumentation::sessionCreatedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->sessionCreated(session);
    }
     
    void InspectorInstrumentation::sessionLoadedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->sessionLoaded(session);
    }
     
    void InspectorInstrumentation::sessionModifiedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->sessionModified(session);
    }
     
    void InspectorInstrumentation::segmentCreatedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->segmentCreated(segment);
    }
     
    void InspectorInstrumentation::segmentCompletedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->segmentCompleted(segment);
    }
     
    void InspectorInstrumentation::segmentLoadedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->segmentLoaded(segment);
    }
     
    void InspectorInstrumentation::segmentUnloadedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->segmentUnloaded();
    }
     
    void InspectorInstrumentation::captureStartedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->captureStarted();
    }
     
    void InspectorInstrumentation::captureStoppedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->captureStopped();
    }
     
    void InspectorInstrumentation::playbackStartedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->playbackStarted();
    }
     
    void InspectorInstrumentation::playbackPausedImpl(InstrumentingAgents* instrumentingAgents, const ReplayPosition& position)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->playbackPaused(position);
    }
     
    void InspectorInstrumentation::playbackHitPositionImpl(InstrumentingAgents* instrumentingAgents, const ReplayPosition& position)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->playbackHitPosition(position);
    }
     
    void InspectorInstrumentation::playbackFinishedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
    replayAgent->playbackFinished();
    }
    #endif
     
    void InspectorInstrumentation::networkStateChangedImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
    applicationCacheAgent->networkStateChanged();
    }
     
    void InspectorInstrumentation::updateApplicationCacheStatusImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
    {
    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
    applicationCacheAgent->updateApplicationCacheStatus(frame);
    }
     
    bool InspectorInstrumentation::consoleAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
    {
    InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext);
    InspectorConsoleAgent* consoleAgent = instrumentingAgents ? instrumentingAgents->webConsoleAgent() : nullptr;
    return consoleAgent && consoleAgent->enabled();
    }
     
    bool InspectorInstrumentation::timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
    {
    InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext);
    return instrumentingAgents && instrumentingAgents->inspectorTimelineAgent();
    }
     
    bool InspectorInstrumentation::replayAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
    {
    #if ENABLE(WEB_REPLAY)
    InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext);
    return instrumentingAgents && instrumentingAgents->inspectorReplayAgent();
    #else
    UNUSED_PARAM(scriptExecutionContext);
    return false;
    #endif
    }
     
    void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
    {
    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    domDebuggerAgent->pauseOnNativeEventIfNeeded(isDOMEvent, eventName, synchronous);
    }
     
    void InspectorInstrumentation::cancelPauseOnNativeEvent(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
    debuggerAgent->cancelPauseOnNextStatement();
    }
     
    void InspectorInstrumentation::didRequestAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, requestAnimationFrameEventName, true);
     
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didRequestAnimationFrame(callbackId, frame);
    }
     
    void InspectorInstrumentation::didCancelAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, cancelAnimationFrameEventName, true);
     
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    timelineAgent->didCancelAnimationFrame(callbackId, frame);
    }
     
    InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
    {
    pauseOnNativeEventIfNeeded(instrumentingAgents, false, animationFrameFiredEventName, false);
     
    int timelineAgentId = 0;
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
    timelineAgent->willFireAnimationFrame(callbackId, frame);
    timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
    }
     
    void InspectorInstrumentation::didFireAnimationFrameImpl(const InspectorInstrumentationCookie& cookie)
    {
    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    timelineAgent->didFireAnimationFrame();
    }
     
    void InspectorInstrumentation::registerInstrumentingAgents(InstrumentingAgents* instrumentingAgents)
    {
    if (!instrumentingAgentsSet)
    instrumentingAgentsSet = new HashSet<InstrumentingAgents*>();
    instrumentingAgentsSet->add(instrumentingAgents);
    }
     
    void InspectorInstrumentation::unregisterInstrumentingAgents(InstrumentingAgents* instrumentingAgents)
    {
    if (!instrumentingAgentsSet)
    return;
    instrumentingAgentsSet->remove(instrumentingAgents);
    if (instrumentingAgentsSet->isEmpty()) {
    delete instrumentingAgentsSet;
    instrumentingAgentsSet = nullptr;
    }
    }
     
    InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
    {
    if (!cookie.instrumentingAgents())
    return nullptr;
    InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspectorTimelineAgent();
    if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
    return timelineAgent;
    return nullptr;
    }
     
    InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
    {
    if (!page)
    return nullptr;
    return instrumentationForPage(page);
    }
     
    InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForRenderer(RenderObject* renderer)
    {
    return instrumentingAgentsForFrame(&renderer->frame());
    }
     
    InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
    {
    if (!workerGlobalScope)
    return nullptr;
    return instrumentationForWorkerGlobalScope(workerGlobalScope);
    }
     
    InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocumentContext(ScriptExecutionContext* context)
    {
    if (context->isWorkerGlobalScope())
    return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context));
    return nullptr;
    }
     
    void InspectorInstrumentation::layerTreeDidChangeImpl(InstrumentingAgents* instrumentingAgents)
    {
    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
    layerTreeAgent->layerTreeDidChange();
    }
     
    void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents* instrumentingAgents, const RenderLayer* renderLayer)
    {
    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
    layerTreeAgent->renderLayerDestroyed(renderLayer);
    }
     
    void InspectorInstrumentation::pseudoElementDestroyedImpl(InstrumentingAgents* instrumentingAgents, PseudoElement* pseudoElement)
    {
    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
    layerTreeAgent->pseudoElementDestroyed(pseudoElement);
    }
     
    } // namespace WebCore
     
    #endif // !ENABLE(INSPECTOR)

  10. #10
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    /*
    * Copyright (C) 2013 University of Washington. All rights reserved.
    * Copyright (C) 2014 Apple Inc. All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
     
    #include "config.h"
    #include "ReplaySessionSegment.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "CapturingInputCursor.h"
    #include "FunctorInputCursor.h"
    #include "ReplayingInputCursor.h"
    #include "SegmentedInputStorage.h"
    #include <wtf/CurrentTime.h>
     
    namespace WebCore {
     
    static unsigned s_nextSegmentIdentifier = 1;
     
    PassRefPtr<ReplaySessionSegment> ReplaySessionSegment::create()
    {
    return adoptRef(new ReplaySessionSegment);
    }
     
    ReplaySessionSegment::ReplaySessionSegment()
    : m_storage(std::make_unique<SegmentedInputStorage>())
    , m_identifier(s_nextSegmentIdentifier++)
    , m_canCapture(true)
    , m_timestamp(currentTimeMS())
    {
    }
     
    ReplaySessionSegment::~ReplaySessionSegment()
    {
    }
     
    PassRefPtr<CapturingInputCursor> ReplaySessionSegment::createCapturingCursor(Page&)
    {
    ASSERT(m_canCapture);
    m_canCapture = false;
    return CapturingInputCursor::create(*m_storage);
    }
     
    PassRefPtr<ReplayingInputCursor> ReplaySessionSegment::createReplayingCursor(Page& page, EventLoopInputDispatcherClient* client)
    {
    return ReplayingInputCursor::create(*m_storage, page, client);
    }
     
    PassRefPtr<FunctorInputCursor> ReplaySessionSegment::createFunctorCursor()
    {
    return FunctorInputCursor::create(*m_storage);
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  11. #11
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    /*
     * Copyright (C) 2014 University of Washington. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * 1.  Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     * 2.  Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
    #include "EventLoopInput.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "CapturingInputCursor.h"
     
    namespace WebCore {
     
    EventLoopInputExtent::EventLoopInputExtent(InputCursor& cursor)
        : m_cursor(cursor)
    {
        if (!m_cursor.isCapturing())
            return;
     
        static_cast<CapturingInputCursor&>(cursor).setWithinEventLoopInputExtent(true);
    }
     
    EventLoopInputExtent::~EventLoopInputExtent()
    {
        if (!m_cursor.isCapturing())
            return;
     
        static_cast<CapturingInputCursor&>(m_cursor).setWithinEventLoopInputExtent(false);
    }
     
    }; // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  12. #12
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    /*
     * Copyright (C) 2011-2013 University of Washington. All rights reserved.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * 1.  Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     * 2.  Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
    #include "EventLoopInputDispatcher.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "Page.h"
    #include "ReplayInputTypes.h"
    #include "ReplayingInputCursor.h"
    #include <wtf/TemporaryChange.h>
     
    #if !LOG_DISABLED
    #include "Logging.h"
    #include "SerializationMethods.h"
    #include <replay/EncodedValue.h>
    #include <wtf/text/CString.h>
    #endif
     
    namespace WebCore {
     
    EventLoopInputDispatcher::EventLoopInputDispatcher(Page& page, ReplayingInputCursor& cursor, EventLoopInputDispatcherClient* client)
        : m_page(page)
        , m_client(client)
        , m_cursor(cursor)
        , m_timer(this, &EventLoopInputDispatcher::timerFired)
        , m_runningInput(nullptr)
        , m_dispatching(false)
        , m_running(false)
        , m_speed(DispatchSpeed::FastForward)
        , m_previousDispatchStartTime(0.0)
        , m_previousInputTimestamp(0.0)
    {
    }
     
    void EventLoopInputDispatcher::run()
    {
        ASSERT(!m_running);
        m_running = true;
     
        LOG(WebReplay, "%-20s Starting dispatch of event loop inputs for page: %p\n", "ReplayEvents", &m_page);
        dispatchInputSoon();
    }
     
    void EventLoopInputDispatcher::pause()
    {
        ASSERT(!m_dispatching);
        ASSERT(m_running);
        m_running = false;
     
        LOG(WebReplay, "%-20s Pausing dispatch of event loop inputs for page: %p\n", "ReplayEvents", &m_page);
        if (m_timer.isActive())
            m_timer.stop();
    }
     
    void EventLoopInputDispatcher::timerFired(Timer<EventLoopInputDispatcher>*)
    {
        dispatchInput();
    }
     
    void EventLoopInputDispatcher::dispatchInputSoon()
    {
        ASSERT(m_running);
     
        // We may already have an input if replay was paused just before dispatching.
        if (!m_runningInput)
            m_runningInput = static_cast<EventLoopInputBase*>(m_cursor.uncheckedLoadInput(InputQueue::EventLoopInput));
     
        if (m_timer.isActive())
            m_timer.stop();
     
        double waitInterval = 0;
     
        if (m_speed == DispatchSpeed::RealTime) {
            // The goal is to reproduce the dispatch delay between inputs as it was
            // was observed during the recording. So, we need to compute how much time
            // to wait such that the elapsed time plus the wait time will equal the
            // observed delay between the previous and current input.
     
            if (!m_previousInputTimestamp)
                m_previousInputTimestamp = m_runningInput->timestamp();
     
            double targetInterval = m_runningInput->timestamp() - m_previousInputTimestamp;
            double elapsed = monotonicallyIncreasingTime() - m_previousDispatchStartTime;
            waitInterval = targetInterval - elapsed;
        }
     
        // A negative wait time means that dispatch took longer on replay than on
        // capture. In this case, proceed without waiting at all.
        if (waitInterval < 0)
            waitInterval = 0;
     
        if (waitInterval > 1000.0) {
            LOG_ERROR("%-20s Tried to wait for over 1000 seconds before dispatching next event loop input; this is probably a bug.", "ReplayEvents");
            waitInterval = 0;
        }
     
        LOG(WebReplay, "%-20s (WAIT: %.3f ms)", "ReplayEvents", waitInterval * 1000.0);
        m_timer.startOneShot(waitInterval);
    }
     
    void EventLoopInputDispatcher::dispatchInput()
    {
        ASSERT(m_runningInput);
        ASSERT(!m_dispatching);
     
        if (m_speed == DispatchSpeed::RealTime) {
            m_previousDispatchStartTime = monotonicallyIncreasingTime();
            m_previousInputTimestamp = m_runningInput->timestamp();
        }
     
    #if !LOG_DISABLED
        EncodedValue encodedInput = EncodingTraits<NondeterministicInputBase>::encodeValue(*m_runningInput);
        String jsonString = encodedInput.asObject()->toJSONString();
     
        LOG(WebReplay, "%-20s ----------------------------------------------", "ReplayEvents");
        LOG(WebReplay, "%-20s >DISPATCH: %s %s\n", "ReplayEvents", m_runningInput->type().string().utf8().data(), jsonString.utf8().data());
    #endif
     
        m_client->willDispatchInput(*m_runningInput);
        // Client could stop replay in the previous callback, so check again.
        if (!m_running)
            return;
     
        {
            TemporaryChange<bool> change(m_dispatching, true);
            m_runningInput->dispatch(m_page.replayController());
        }
     
        EventLoopInputBase* dispatchedInput = m_runningInput;
        m_runningInput = nullptr;
     
        // Notify clients that the event was dispatched.
        m_client->didDispatchInput(*dispatchedInput);
        if (dispatchedInput->type() == inputTypes().EndSegmentSentinel) {
            m_running = false;        
            m_dispatching = false;
            m_client->didDispatchFinalInput();
            return;
        }
     
        // Clients could stop replay during event dispatch, or from any callback above.
        if (!m_running)
            return;
     
        dispatchInputSoon();
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  13. #13
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    /*
     * Copyright (C) 2011-2013 University of Washington.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     * 1. Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     * 2. Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "AllReplayInputs.h"
    #include "MainFrame.h"
    #include "NavigationScheduler.h"
    #include "Page.h"
    #include "ReplayController.h"
    #include "URL.h"
    #include "UserInputBridge.h"
     
    namespace WebCore {
     
    // Sentinel inputs.
    void BeginSegmentSentinel::dispatch(ReplayController&)
    {
    }
     
    void EndSegmentSentinel::dispatch(ReplayController&)
    {
    }
     
    // Navigation inputs.
    void InitialNavigation::dispatch(ReplayController& controller)
    {
        controller.page().mainFrame().navigationScheduler().scheduleLocationChange(m_securityOrigin.get(), m_url, m_referrer);
    }
     
    void HandleKeyPress::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().handleKeyEvent(platformEvent(), InputSource::Synthetic);
    }
     
    // User interaction inputs.
    void HandleMouseMove::dispatch(ReplayController& controller)
    {
        if (m_scrollbarTargeted)
            controller.page().userInputBridge().handleMouseMoveOnScrollbarEvent(platformEvent(), InputSource::Synthetic);
        else
            controller.page().userInputBridge().handleMouseMoveEvent(platformEvent(), InputSource::Synthetic);
    }
     
    void HandleMousePress::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().handleMousePressEvent(platformEvent(), InputSource::Synthetic);
    }
     
    void HandleMouseRelease::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().handleMouseReleaseEvent(platformEvent(), InputSource::Synthetic);
    }
     
    void HandleWheelEvent::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().handleWheelEvent(platformEvent(), InputSource::Synthetic);
    }
     
    void LogicalScrollPage::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().logicalScrollRecursively(direction(), granularity(), InputSource::Synthetic);
    }
     
    void ScrollPage::dispatch(ReplayController& controller)
    {
        controller.page().userInputBridge().scrollRecursively(direction(), granularity(), InputSource::Synthetic);
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  14. #14
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    /*
     * Copyright (C) 2013 University of Washington. All rights reserved.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * 1.  Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     * 2.  Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
    #include "ReplaySession.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "ReplaySessionSegment.h"
    #include <wtf/CurrentTime.h>
     
    namespace WebCore {
     
    static unsigned s_nextIdentifier = 1;
     
    PassRefPtr<ReplaySession> ReplaySession::create()
    {
        return adoptRef(new ReplaySession());
    }
     
    ReplaySession::ReplaySession()
        : m_identifier(s_nextIdentifier++)
        , m_timestamp(currentTimeMS())
    {
    }
     
    ReplaySession::~ReplaySession()
    {
    }
     
    PassRefPtr<ReplaySessionSegment> ReplaySession::at(size_t position) const
    {
        return m_segments.at(position);
    }
     
    void ReplaySession::appendSegment(PassRefPtr<ReplaySessionSegment> prpSegment)
    {
        RefPtr<ReplaySessionSegment> segment = prpSegment;
     
        // For now, only support one segment.
        ASSERT(!m_segments.size());
     
        // Since replay locations are specified with segment IDs, we can only
        // have one instance of a segment in the session.
        size_t offset = m_segments.find(segment);
        ASSERT_UNUSED(offset, offset == notFound);
     
        m_segments.append(segment.release());
    }
     
    void ReplaySession::insertSegment(size_t position, PassRefPtr<ReplaySessionSegment> segment)
    {
        ASSERT(position < m_segments.size());
        m_segments.insert(position, segment);
    }
     
    void ReplaySession::removeSegment(size_t position)
    {
        ASSERT(position < m_segments.size());
        m_segments.remove(position);
    }
     
    }; // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  15. #15
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    /*
     * Copyright (C) 2013 University of Washington. All rights reserved.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * 1.  Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     * 2.  Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
    #include "CapturingInputCursor.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "Logging.h"
    #include "SegmentedInputStorage.h"
     
    namespace WebCore {
     
    CapturingInputCursor::CapturingInputCursor(SegmentedInputStorage& storage)
        : m_storage(storage)
        , m_withinEventLoopInputExtent(false)
    {
        LOG(WebReplay, "%-30sCreated capture cursor=%p.\n", "[ReplayController]", this);
    }
     
    CapturingInputCursor::~CapturingInputCursor()
    {
        LOG(WebReplay, "%-30sDestroyed capture cursor=%p.\n", "[ReplayController]", this);
    }
     
     
    PassRefPtr<CapturingInputCursor> CapturingInputCursor::create(SegmentedInputStorage& storage)
    {
        return adoptRef(new CapturingInputCursor(storage));
    }
     
    void CapturingInputCursor::storeInput(std::unique_ptr<NondeterministicInputBase> input)
    {
        ASSERT(input);
        m_storage.store(std::move(input));
    }
     
    NondeterministicInputBase* CapturingInputCursor::loadInput(InputQueue, const AtomicString&)
    {
        // Can't load inputs from capturing cursor.
        ASSERT_NOT_REACHED();
        return nullptr;
    }
     
    NondeterministicInputBase* CapturingInputCursor::uncheckedLoadInput(InputQueue)
    {
        // Can't load inputs from capturing cursor.
        ASSERT_NOT_REACHED();
        return nullptr;
    }
     
    void CapturingInputCursor::setWithinEventLoopInputExtent(bool withinEventLoopInputExtent)
    {
        // We cannot enter more than one extent at a time, since they represent a single run loop.
        //ASSERT(withinEventLoopInputExtent != m_withinEventLoopInputExtent);
        m_withinEventLoopInputExtent = withinEventLoopInputExtent;
    }
     
    }; // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  16. #16
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    /*
     * Copyright (C) 2013 University of Washington. All rights reserved.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * 1.  Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     * 2.  Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
    #include "ReplayingInputCursor.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "EventLoopInputDispatcher.h"
    #include "SegmentedInputStorage.h"
    #include "SerializationMethods.h"
    #include "WebReplayInputs.h"
    #include <wtf/text/CString.h>
     
    namespace WebCore {
     
    ReplayingInputCursor::ReplayingInputCursor(SegmentedInputStorage& storage, Page& page, EventLoopInputDispatcherClient* client)
        : m_storage(storage)
        , m_dispatcher(std::make_unique<EventLoopInputDispatcher>(page, *this, client))
    {
        for (size_t i = 0; i < static_cast<size_t>(InputQueue::Count); i++)
            m_positions.append(0);
    }
     
    ReplayingInputCursor::~ReplayingInputCursor()
    {
    }
     
    PassRefPtr<ReplayingInputCursor> ReplayingInputCursor::create(SegmentedInputStorage& storage, Page& page, EventLoopInputDispatcherClient* client)
    {
        return adoptRef(new ReplayingInputCursor(storage, page, client));
    }
     
    void ReplayingInputCursor::storeInput(std::unique_ptr<NondeterministicInputBase>)
    {
        // Cannot store inputs from a replaying input cursor.
        ASSERT_NOT_REACHED();
    }
     
    NondeterministicInputBase* ReplayingInputCursor::loadInput(InputQueue queue, const AtomicString& type)
    {
        NondeterministicInputBase* input = uncheckedLoadInput(queue);
     
        if (input->type() != type) {
            LOG_ERROR("%-25s ERROR: Expected replay input of type %s, but got type %s\n", "[ReplayingInputCursor]", type.string().ascii().data(), input->type().string().ascii().data());
            return nullptr;
        }
     
        return input;
    }
     
    NondeterministicInputBase* ReplayingInputCursor::uncheckedLoadInput(InputQueue queue)
    {
        if (m_positions[static_cast<size_t>(queue)] >= m_storage.queueSize(queue)) {
            String queueString = EncodingTraits<InputQueue>::encodeValue(queue).convertTo<String>();
            LOG_ERROR("%-30s ERROR No more inputs remain for determinism queue %s, but one was requested.", "[ReplayingInputCursor]", queueString.ascii().data());
            return nullptr;
        }
     
        return m_storage.load(queue, m_positions[static_cast<size_t>(queue)]++);
    }
     
    }; // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  17. #17
    Nouveau Candidat au Club
    Femme Profil pro
    Ingénieur après-vente
    Inscrit en
    Avril 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur après-vente
    Secteur : Alimentation

    Informations forums :
    Inscription : Avril 2014
    Messages : 25
    Points : 0
    Points
    0
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    /*
     * Copyright (C) 2011-2013 University of Washington.
     * Copyright (C) 2014 Apple Inc. All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     * 1. Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     * 2. Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
     
    #include "config.h"
     
    #if ENABLE(WEB_REPLAY)
     
    #include "Document.h"
    #include "MainFrame.h"
    #include "Page.h"
    #include "SecurityOrigin.h"
    #include "SerializationMethods.h"
    #include "WebReplayInputs.h"
     
    namespace WebCore {
     
    std::unique_ptr<InitialNavigation> InitialNavigation::createFromPage(const Page& page)
    {
        const MainFrame& mainFrame = page.mainFrame();
        ASSERT(mainFrame.document());
     
        // Make sure that this is in sync with ReplayController::beginCapturing().
        RefPtr<SecurityOrigin> originCopy = mainFrame.document()->securityOrigin()->isolatedCopy();
        URL url = mainFrame.document()->url();
        String referrer = mainFrame.loader().referrer();
        return std::make_unique<InitialNavigation>(originCopy, url, referrer);
    }
     
    } // namespace WebCore
     
    #endif // ENABLE(WEB_REPLAY)

  18. #18
    Expert éminent sénior

    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    5 189
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 5 189
    Points : 17 141
    Points
    17 141
    Par défaut
    Désolé, je n'ai pas compris ton problème.

    Cependant, quand tu veux montrer du code, utilise la balise [code]
    Mes principes de bases du codeur qui veut pouvoir dormir:
    • Une variable de moins est une source d'erreur en moins.
    • Un pointeur de moins est une montagne d'erreurs en moins.
    • Un copier-coller, ça doit se justifier... Deux, c'est un de trop.
    • jamais signifie "sauf si j'ai passé trois jours à prouver que je peux".
    • La plus sotte des questions est celle qu'on ne pose pas.
    Pour faire des graphes, essayez yEd.
    le ter nel est le titre porté par un de mes personnages de jeu de rôle

  19. #19
    Membre expérimenté Avatar de Trademark
    Profil pro
    Inscrit en
    Février 2009
    Messages
    762
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 762
    Points : 1 396
    Points
    1 396
    Par défaut
    Poster autant de code et autant de messages est inutile, tu peux les supprimer. Ceux qui veulent lire le code téléchargerons le .zip.

    Or je doute que beaucoup de gens regarde car ton problème n'est pas de la dimension d'une simple discussion, tu nous demande de lire et comprendre pas mal de code, ce qui est ton travail. Pour moi il y a un gros problème, soit tu as vanté des compétences que tu n'avais pas et tu es maintenant bien embêtée, soit tes supérieurs n'ont pas compris la portée de tes compétences et te surestime ou soit apprendre le C++ fait partie du travail.

    Dans tous les cas il n'y a pas 36 solutions, si tu veux mener à bien ton projet il faut que tu passes plusieurs semaines à apprendre le C++ et faire des exercices. Pour cela il y a plein de bon tutoriel et tu peux notamment commencer par ceux de ce site :-)

    Bonne chance.

Discussions similaires

  1. Réponses: 9
    Dernier message: 01/02/2012, 17h30
  2. [VBA-E]probleme lors de la creation de feuille
    Par lcoder dans le forum Macros et VBA Excel
    Réponses: 9
    Dernier message: 15/06/2006, 19h51
  3. Réponses: 2
    Dernier message: 21/04/2006, 15h08
  4. probleme lors de la creation de table
    Par perlgirl dans le forum Requêtes
    Réponses: 2
    Dernier message: 17/11/2005, 09h43
  5. probleme lors de la creation du device
    Par 180degrés dans le forum DirectX
    Réponses: 5
    Dernier message: 18/08/2005, 17h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo